From 67678bb293ab4435fa0140f9ad490ec606cb21d9 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Wed, 26 Oct 2016 09:28:12 +0200 Subject: [PATCH 01/10] Update readme --- README.md | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 81aa47c..08af70b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,30 @@ Simcard management for GLPI -================= +=========================== -Download here : https://github.com/pluginsGLPI/simcard/releases +* Created bt Walid Nouh for GLPi 0.83 +* Updated by Anthony Piesset and Dethegeek for GLPi 0.84 +* Updated by Thierry Bugier Pineau for GLPi 0.85 and 0.90 -Installation -================= -Télécharger l'archive et décompresser la dans votre dossier glpi/plugins/ -Puis sur http://votreadresseglpi.fr section configuration > Plugin -Plugin créé par Walid Nouh pour GLPI 0.83. -Plugin modifié par Anthony Piesset et Dethegeek pour GLPI 0.84. -Plugin modifié par Thierry Bugier Pineau pour GLPI 0.85 et GLPI 0.90. +Installation (en) +----------------- + +* Download from: https://github.com/pluginsGLPI/simcard/releases +* Uncompress in your `glpi/plugins` directory +* Install, enable and configure from `http://yourglpiaddress.com` from Configuration > Plugins section. + +Installation (fr) +----------------- + +* Téléchargez depuis : https://github.com/pluginsGLPI/simcard/releases +* Décompressez dans votre dossier `glpi/plugins` +* Installez, activez et configurez sur `http://votreadresseglpi.fr` dans la section Configuration > Plugins + +Contributing +------------ + +* Open a ticket for each bug/feature so it can be discussed +* Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins.html) +* Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching +* Work on a new branch on your own fork +* Open a PR that will be reviewed by a developer From 818b7c40d89391879107c75431e44877186944ea Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 9 Feb 2017 09:01:37 +0100 Subject: [PATCH 02/10] Use external tool project --- .gitignore | 5 + .travis.yml | 51 ++ RoboFile.php | 13 + composer.json | 7 + composer.lock | 1217 +++++++++++++++++++++++++++++++++++++ tools/extract_template.sh | 22 - tools/modify_headers.pl | 102 ---- tools/move_to_po.php | 307 ---------- tools/update_mo.pl | 29 - tools/update_po.pl | 30 - 10 files changed, 1293 insertions(+), 490 deletions(-) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 RoboFile.php create mode 100644 composer.json create mode 100644 composer.lock delete mode 100755 tools/extract_template.sh delete mode 100644 tools/modify_headers.pl delete mode 100644 tools/move_to_po.php delete mode 100644 tools/update_mo.pl delete mode 100644 tools/update_po.pl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f033123 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +dist/ +vendor/ +.gh_token +*.min.* + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f2963c9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,51 @@ +language: php +php: + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - nightly + +#env: +# global: +# - DB=mysql +# matrix: +# - GLPIVER=9.1/bugfixes +# - GLPIVER=master + +before_script: + - composer self-update +# - git clone --depth=1 https://github.com/glpi-project/glpi -b $GLPIVER ../glpi && cd ../glpi +# - composer install --no-dev +# - mysql -u root -e 'create database glpitest;' +# - php tools/cliinstall.php --db=glpi-test --user=travis --tests +# - mv ../{LNAME} plugins/{LNAME} +# - cd plugins/{LNAME} + - composer install -o + + +script: + - vendor/bin/robo --no-interaction code:cs +# - mysql -u root -e 'select version();' +# - ./vendor/bin/atoum -bf tests/bootstrap.php -d tests/units/ + + +matrix: +# exclude: +# - php: 5.4 +# env: GLPIVER=master + allow_failures: + - php: nightly + +cache: + directories: + - $HOME/.composer/cache + +#notifications: +# irc: +# channels: +# - "irc.freenode.org#channel" +# on_success: change +# on_failure: always +# use_notice: true +# skip_join: true diff --git a/RoboFile.php b/RoboFile.php new file mode 100644 index 0000000..f6360f5 --- /dev/null +++ b/RoboFile.php @@ -0,0 +1,13 @@ +=5.4.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "psr/log": "~1", + "symfony/console": "^2.8|~3", + "symfony/event-dispatcher": "^2.5|~3", + "symfony/finder": "^2.5|~3" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "satooshi/php-coveralls": "^1.0", + "squizlabs/php_codesniffer": "^2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Consolidation\\AnnotatedCommand\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Greg Anderson", + "email": "greg.1.anderson@greenknowe.org" + } + ], + "description": "Initialize Symfony Console commands from annotated command class methods.", + "time": "2017-02-04T06:13:54+00:00" + }, + { + "name": "consolidation/log", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/consolidation/log.git", + "reference": "74ba81b4edc585616747cc5c5309ce56fec41254" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/consolidation/log/zipball/74ba81b4edc585616747cc5c5309ce56fec41254", + "reference": "74ba81b4edc585616747cc5c5309ce56fec41254", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "psr/log": "~1.0", + "symfony/console": "~2.5|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Consolidation\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Greg Anderson", + "email": "greg.1.anderson@greenknowe.org" + } + ], + "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", + "time": "2016-03-23T23:46:42+00:00" + }, + { + "name": "consolidation/output-formatters", + "version": "3.1.7", + "source": { + "type": "git", + "url": "https://github.com/consolidation/output-formatters.git", + "reference": "da39a0f14d5aaaee06732bb7cef2aea1de056b40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/da39a0f14d5aaaee06732bb7cef2aea1de056b40", + "reference": "da39a0f14d5aaaee06732bb7cef2aea1de056b40", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/console": "~2.5|~3.0", + "symfony/finder": "~2.5|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "satooshi/php-coveralls": "^1.0", + "squizlabs/php_codesniffer": "2.*", + "victorjonsson/markdowndocs": "^1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Consolidation\\OutputFormatters\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Greg Anderson", + "email": "greg.1.anderson@greenknowe.org" + } + ], + "description": "Format text by applying transformations provided by plug-in formatters.", + "time": "2017-01-21T06:26:40+00:00" + }, + { + "name": "consolidation/robo", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/consolidation/Robo.git", + "reference": "b6ac24dbbfacbc31069642ae502a8859b3c4f613" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/consolidation/Robo/zipball/b6ac24dbbfacbc31069642ae502a8859b3c4f613", + "reference": "b6ac24dbbfacbc31069642ae502a8859b3c4f613", + "shasum": "" + }, + "require": { + "consolidation/annotated-command": "^2.2", + "consolidation/log": "~1", + "consolidation/output-formatters": "^3.1.5", + "league/container": "^2.2", + "php": ">=5.5.0", + "symfony/console": "~2.8|~3.0", + "symfony/event-dispatcher": "~2.5|~3.0", + "symfony/filesystem": "~2.5|~3.0", + "symfony/finder": "~2.5|~3.0", + "symfony/process": "~2.5|~3.0" + }, + "replace": { + "codegyre/robo": "< 1.0" + }, + "require-dev": { + "codeception/aspect-mock": "~1", + "codeception/base": "^2.2.6", + "codeception/verify": "^0.3.2", + "henrikbjorn/lurker": "~1", + "natxet/cssmin": "~3", + "patchwork/jsqueeze": "~2", + "pear/archive_tar": "^1.4.2", + "phpunit/php-code-coverage": "~2|~4", + "satooshi/php-coveralls": "~1", + "squizlabs/php_codesniffer": "~2" + }, + "suggest": { + "henrikbjorn/lurker": "For monitoring filesystem changes in taskWatch", + "natxet/CssMin": "For minifying JS files in taskMinify", + "patchwork/jsqueeze": "For minifying JS files in taskMinify", + "pear/archive_tar": "Allows tar archives to be created and extracted in taskPack and taskExtract, respectively." + }, + "bin": [ + "robo" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "scripts/composer/ScriptHandler.php" + ], + "psr-4": { + "Robo\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Davert", + "email": "davert.php@resend.cc" + } + ], + "description": "Modern task runner", + "time": "2017-02-08T20:53:21+00:00" + }, + { + "name": "container-interop/container-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "time": "2014-12-30T15:22:37+00:00" + }, + { + "name": "glpi-project/coding-standard", + "version": "0.5", + "source": { + "type": "git", + "url": "https://github.com/glpi-project/coding-standard.git", + "reference": "e19495c896a01199a2fec2e65b7613310598cf96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/glpi-project/coding-standard/zipball/e19495c896a01199a2fec2e65b7613310598cf96", + "reference": "e19495c896a01199a2fec2e65b7613310598cf96", + "shasum": "" + }, + "require": { + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPLv3" + ], + "authors": [ + { + "name": "Teclib'", + "email": "contact@teclib.com", + "homepage": "https://teclib.com" + } + ], + "description": "GLPI PHP CodeSniffer Coding Standard", + "keywords": [ + "codesniffer", + "glpi", + "phpcs" + ], + "time": "2017-01-06T11:10:46+00:00" + }, + { + "name": "glpi-project/tools", + "version": "0.1.1", + "source": { + "type": "git", + "url": "https://github.com/glpi-project/tools.git", + "reference": "89083f6e71fac05190c7cc76a9c5afd8b1f421ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/glpi-project/tools/zipball/89083f6e71fac05190c7cc76a9c5afd8b1f421ef", + "reference": "89083f6e71fac05190c7cc76a9c5afd8b1f421ef", + "shasum": "" + }, + "require": { + "consolidation/robo": "dev-master@dev", + "glpi-project/coding-standard": "0.5", + "natxet/cssmin": "~3.0", + "patchwork/jsqueeze": "~1.0" + }, + "bin": [ + "tools/plugin-release", + "tools/extract_template.sh", + "tools/modify_headers.pl" + ], + "type": "library", + "autoload": { + "psr-4": { + "Glpi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPLv3" + ], + "authors": [ + { + "name": "Teclib'", + "email": "glpi@teclib.com", + "homepage": "https://teclib.com" + } + ], + "description": "Various tools for GLPI and its plugins", + "keywords": [ + "glpi", + "plugins", + "tools" + ], + "time": "2017-02-08T08:20:09+00:00" + }, + { + "name": "league/container", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/container.git", + "reference": "c0e7d947b690891f700dc4967ead7bdb3d6708c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/container/zipball/c0e7d947b690891f700dc4967ead7bdb3d6708c1", + "reference": "c0e7d947b690891f700dc4967ead7bdb3d6708c1", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "php": ">=5.4.0" + }, + "provide": { + "container-interop/container-interop-implementation": "^1.1" + }, + "replace": { + "orno/di": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Container\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Phil Bennett", + "email": "philipobenito@gmail.com", + "homepage": "http://www.philipobenito.com", + "role": "Developer" + } + ], + "description": "A fast and intuitive dependency injection container.", + "homepage": "https://github.com/thephpleague/container", + "keywords": [ + "container", + "dependency", + "di", + "injection", + "league", + "provider", + "service" + ], + "time": "2016-03-17T11:07:59+00:00" + }, + { + "name": "natxet/CssMin", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/natxet/CssMin.git", + "reference": "92de3fe3ccb4f8298d31952490ef7d5395855c39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/natxet/CssMin/zipball/92de3fe3ccb4f8298d31952490ef7d5395855c39", + "reference": "92de3fe3ccb4f8298d31952490ef7d5395855c39", + "shasum": "" + }, + "require": { + "php": ">=5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joe Scylla", + "email": "joe.scylla@gmail.com", + "homepage": "https://profiles.google.com/joe.scylla" + } + ], + "description": "Minifying CSS", + "homepage": "http://code.google.com/p/cssmin/", + "keywords": [ + "css", + "minify" + ], + "time": "2015-09-25T11:13:11+00:00" + }, + { + "name": "patchwork/jsqueeze", + "version": "v1.0.7", + "source": { + "type": "git", + "url": "https://github.com/tchwork/jsqueeze.git", + "reference": "f90a933213534b93e4ff3c2c3026ff7458f7721b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tchwork/jsqueeze/zipball/f90a933213534b93e4ff3c2c3026ff7458f7721b", + "reference": "f90a933213534b93e4ff3c2c3026ff7458f7721b", + "shasum": "" + }, + "require": { + "php": ">=5.1.4" + }, + "type": "library", + "autoload": { + "psr-0": { + "JSqueeze": "class/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + } + ], + "description": "Efficient JavaScript minification in PHP", + "homepage": "https://github.com/tchwork/jsqueeze", + "keywords": [ + "compression", + "javascript", + "minification" + ], + "time": "2015-03-25T10:11:08+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27T11:43:31+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30T07:12:33+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-11-25T06:54:22+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "86dd55a522238211f9f3631e3361703578941d9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/86dd55a522238211f9f3631e3361703578941d9a", + "reference": "86dd55a522238211f9f3631e3361703578941d9a", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-02-02T03:30:00+00:00" + }, + { + "name": "symfony/console", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "7a8405a9fc175f87fed8a3c40856b0d866d61936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/7a8405a9fc175f87fed8a3c40856b0d866d61936", + "reference": "7a8405a9fc175f87fed8a3c40856b0d866d61936", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/filesystem": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "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": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-02-06T12:04:21+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "b4d9818f127c60ce21ed62c395da7df868dc8477" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/b4d9818f127c60ce21ed62c395da7df868dc8477", + "reference": "b4d9818f127c60ce21ed62c395da7df868dc8477", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-01-28T02:37:08+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "9137eb3a3328e413212826d63eeeb0217836e2b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9137eb3a3328e413212826d63eeeb0217836e2b6", + "reference": "9137eb3a3328e413212826d63eeeb0217836e2b6", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "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": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-01-02T20:32:22+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", + "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "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": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2017-01-08T20:47:33+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6", + "reference": "8c71141cae8e2957946b403cc71a67213c0380d6", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "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": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2017-01-02T20:32:22+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.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": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, + { + "name": "symfony/process", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "32646a7cf53f3956c76dcb5c82555224ae321858" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/32646a7cf53f3956c76dcb5c82555224ae321858", + "reference": "32646a7cf53f3956c76dcb5c82555224ae321858", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "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": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2017-02-03T12:11:38+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": true, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/tools/extract_template.sh b/tools/extract_template.sh deleted file mode 100755 index 83d4c99..0000000 --- a/tools/extract_template.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -soft='GLPI - Simcard plugin' -version='0.85' -email=adelaunay@teclib.com -copyright='INDEPNET Development Team' - -#xgettext *.php */*.php -copyright-holder='$copyright' --package-name=$soft --package-version=$version --msgid-bugs-address=$email -o locales/en_GB.po -L PHP --from-code=UTF-8 --force-po -i --keyword=_n:1,2 --keyword=__ --keyword=_e - -# Only strings with domain specified are extracted (use Xt args of keyword param to set number of args needed) - -xgettext *.php */*.php -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po \ - --keyword=_n:1,2,4t --keyword=__s:1,2t --keyword=__:1,2t --keyword=_e:1,2t --keyword=_x:1c,2,3t --keyword=_ex:1c,2,3t \ - --keyword=_sx:1c,2,3t --keyword=_nx:1c,2,3,5t - - -### for using tx : -##tx set --execute --auto-local -r GLPI_example.glpi-084-current 'locales/.po' --source-lang en --source-file locales/glpi.pot -## tx push -s -## tx pull -a - - diff --git a/tools/modify_headers.pl b/tools/modify_headers.pl deleted file mode 100644 index 71719e2..0000000 --- a/tools/modify_headers.pl +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/perl -#!/usr/bin/perl -w - -# ---------------------------------------------------------------------- -# GLPI - Gestionnaire Libre de Parc Informatique -# Copyright (C) 2003-2006 by the INDEPNET Development Team. -# -# http://indepnet.net/ http://glpi-project.org -# ---------------------------------------------------------------------- -# -# LICENSE -# -# This file is part of GLPI. -# -# GLPI is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# GLPI is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GLPI; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# ------------------------------------------------------------------------ - - -do_dir(".."); - - -sub do_dir{ -local ($dir)=@_; -print "Entering $dir\n"; - -opendir(DIRHANDLE,$dir)||die "ERROR: can not read current directory\n"; -foreach (readdir(DIRHANDLE)){ - if ($_ ne '..' && $_ ne '.'){ - if (-d "$dir/$_"){ - if ($_ !~ m/.svn/i && $_ !~ m/CVS/i && $_ !~ m/lib/i){ - - do_dir("$dir/$_"); - } - } else { - if(!(-l "$dir/$_")){ - if ((index($_,".php",0)!=-1)||(index($_,".txt",0)!=-1)||(index($_,".css",0)!=-1)){ - do_file("$dir/$_"); - } - } - } - } -} -closedir DIRHANDLE; - -} - -sub do_file{ - local ($file)=@_; - print $file."\n"; - ### DELETE HEADERS - open(INIT_FILE,$file); - @lines=; - close(INIT_FILE); - - open(TMP_FILE,">/tmp/tmp_glpi.txt"); - - $status=''; - foreach (@lines){ - if ($_ =~ m/\*\//){ - $status="END"; - } - - if ($status =~ m/END/||$status !~ m/BEGIN/){ - print TMP_FILE $_; - } - - if ($status !~ m/END/){ - if ($_ =~ m/\/\*/){ - $status="BEGIN"; - ##### ADD NEW HEADERS - open(HEADER_FILE,"HEADER"); - @headers=; - foreach (@headers){ - print TMP_FILE $_; - } - close(HEADER_FILE) ; - - } - } - } - close(TMP_FILE); - - system("cp -f /tmp/tmp_glpi.txt $file"); - - - -} - - - diff --git a/tools/move_to_po.php b/tools/move_to_po.php deleted file mode 100644 index bd2d490..0000000 --- a/tools/move_to_po.php +++ /dev/null @@ -1,307 +0,0 @@ -. - -------------------------------------------------------------------------- - */ - -// ---------------------------------------------------------------------- -// Original Author of file: Julien Dombre -// Purpose of file: -// ---------------------------------------------------------------------- - -chdir(dirname($_SERVER["SCRIPT_FILENAME"])); - -if ($argv) { - for ($i=1 ; $i'.$sing_trans.' '.$current_string_plural.'->'.$plural_trans."\n"; - if (!strlen($sing_trans) || !strlen($plural_trans)) { -// echo "clean\n"; - $sing_trans = ''; - $plural_trans = ''; - } - $content = "msgstr[0] \"$sing_trans\"\n"; - $content .= "msgstr[1] \"$plural_trans\"\n"; - } - } else { - $content=''; - } - } - $context = ''; - } - // Standard replacement - $content = preg_replace('/charset=CHARSET/','charset=UTF-8',$content); - - if (preg_match('/Plural-Forms/',$content)) { - $content = "\"Plural-Forms: nplurals=2; plural=(n != 1)\\n\"\n"; - } - - if (fwrite($po, $content) === FALSE) { - echo "unable to write in po file"; - exit; - } - - } -} -fclose($pot); -fclose($po); - - -function search_in_dict($string, $context) { - global $REFLANG, $LANG; - - if ($context) { - $string = "$context/$string"; - } - - $ponctmatch = "([\.: \(\)]*)"; - $varmatch = "(%s)*"; - - if (preg_match("/$varmatch$ponctmatch(.*)$ponctmatch$varmatch$/U",$string,$reg)) { -// print_r($reg); - $left = $reg[1]; - $left .= $reg[2]; - $string = $reg[3]; - $right = $reg[4]; - if (isset($reg[5])) { - $right .= $reg[5]; - } - } - -// echo $left.' <- '.$string.' -> '.$right."\n"; - foreach ($REFLANG as $mod => $data) { - - foreach ($data as $key => $val) { - - if (!is_array($val)){ - if (!isset($LANG[$mod][$key])) { - continue; - } - - // Search same case with punc - if (strcmp($val,$left.$string.$right) === 0) { - return $LANG[$mod][$key]; - } - // Search same case with punc - if (strcasecmp($val,$left.$string.$right) === 0) { - return $LANG[$mod][$key]; - } - - // Search same case with left punc - if (strcmp($val,$left.$string) === 0) { - return $LANG[$mod][$key].$right; - } - // Search same case with left punc - if (strcasecmp($val,$left.$string) === 0) { - return $LANG[$mod][$key].$right; - } - - // Search same case with right punc - if (strcmp($val,$string.$right) === 0) { - return $left.$LANG[$mod][$key]; - } - // Search same case with right punc - if (strcasecmp($val,$string.$right) === 0) { - return $left.$LANG[$mod][$key]; - } - - // Search same case without punc - if (strcmp($val,$string) === 0) { - return $left.$LANG[$mod][$key].$right; - } - // Search non case sensitive - if (strcasecmp($val,$string) === 0) { - return $left.$LANG[$mod][$key].$right; - } - } else { - //toolbox::logdebug($val); - //toolbox::logdebug($key); - //toolbox::logdebug($mod); - foreach ($val as $k => $v) { - if (!isset($LANG[$mod][$key][$k])) { - continue; - } - - // Search same case with punc - if (strcmp($v,$left.$string.$right) === 0) { - return $LANG[$mod][$key][$k]; - } - // Search same case with punc - if (strcasecmp($v,$left.$string.$right) === 0) { - return $LANG[$mod][$key][$k]; - } - - // Search same case with left punc - if (strcmp($v,$left.$string) === 0) { - return $LANG[$mod][$key][$k].$right; - } - // Search same case with left punc - if (strcasecmp($v,$left.$string) === 0) { - return $LANG[$mod][$key][$k].$right; - } - - // Search same case with right punc - if (strcmp($v,$string.$right) === 0) { - return $left.$LANG[$mod][$key][$k]; - } - // Search same case with right punc - if (strcasecmp($v,$string.$right) === 0) { - return $left.$LANG[$mod][$key][$k]; - } - - // Search same case without punc - if (strcmp($v,$string) === 0) { - return $left.$LANG[$mod][$key][$k].$right; - } - // Search non case sensitive - if (strcasecmp($v,$string) === 0) { - return $left.$LANG[$mod][$key][$k].$right; - } - } - } - } - } - - return ""; -} -?> diff --git a/tools/update_mo.pl b/tools/update_mo.pl deleted file mode 100644 index ed44da6..0000000 --- a/tools/update_mo.pl +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl -#!/usr/bin/perl -w - -if (@ARGV!=0){ -print "USAGE update_mo.pl\n\n"; - -exit(); -} - - -opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; -foreach (readdir(DIRHANDLE)){ - if ($_ ne '..' && $_ ne '.'){ - - if(!(-l "$dir/$_")){ - if (index($_,".po",0)==length($_)-3) { - $lang=$_; - $lang=~s/\.po//; - - `msgfmt locales/$_ -o locales/$lang.mo`; - } - } - - } -} -closedir DIRHANDLE; - -# -# diff --git a/tools/update_po.pl b/tools/update_po.pl deleted file mode 100644 index ce44ea7..0000000 --- a/tools/update_po.pl +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl -#!/usr/bin/perl -w - -if (@ARGV!=2){ -print "USAGE update_po.pl transifex_login transifex_password\n\n"; - -exit(); -} -$user = $ARGV[0]; -$password = $ARGV[1]; - -opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; -foreach (readdir(DIRHANDLE)){ - if ($_ ne '..' && $_ ne '.'){ - - if(!(-l "$dir/$_")){ - if (index($_,".po",0)==length($_)-3) { - $lang=$_; - $lang=~s/\.po//; - - `wget --user=$user --password=$password --output-document=locales/$_ http://www.transifex.net/api/2/project/GLPI_example/resource/glpipot/translation/$lang/?file=$_`; - } - } - - } -} -closedir DIRHANDLE; - -# -# From d40152b56a2e2a1177c23cacecfce467e572a738 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 9 Feb 2017 09:01:58 +0100 Subject: [PATCH 03/10] Fix CS (from phpcbf) --- front/simcard.form.php | 14 +- front/simcard.php | 2 +- front/simcard_item.form.php | 2 +- hook.php | 62 ++++---- inc/config.class.php | 48 +++--- inc/phoneoperator.class.php | 13 +- inc/profile.class.php | 143 +++++++++-------- inc/simcard.class.php | 279 ++++++++++++++++----------------- inc/simcard_item.class.php | 93 ++++++----- inc/simcardinjection.class.php | 5 +- inc/simcardsize.class.php | 15 +- inc/simcardtype.class.php | 7 +- inc/simcardvoltage.class.php | 15 +- setup.php | 36 ++--- 14 files changed, 361 insertions(+), 373 deletions(-) diff --git a/front/simcard.form.php b/front/simcard.form.php index 49a857a..2d6239f 100644 --- a/front/simcard.form.php +++ b/front/simcard.form.php @@ -58,7 +58,7 @@ } Html::back(); -// delete a simcard + // delete a simcard } else if (isset($_POST["delete"])) { $simcard->check($_POST['id'], DELETE); $ok = $simcard->delete($_POST); @@ -72,12 +72,12 @@ } else if (isset($_POST["restore"])) { $simcard->check($_POST['id'], PURGE); if ($simcard->restore($_POST)) { - Event::log($_POST["id"],"simcard", 4, "inventory", + Event::log($_POST["id"], "simcard", 4, "inventory", //TRANS: %s is the user login sprintf(__('%s restores the item'), $_SESSION["glpiname"])); } $simcard->redirectToList(); - + } else if (isset($_REQUEST["purge"])) { $simcard->check($_REQUEST['id'], PURGE); if ($simcard->delete($_REQUEST, 1)) { @@ -86,8 +86,8 @@ sprintf(__('%s purges an item'), $_SESSION["glpiname"])); } $simcard->redirectToList(); - -//update a simcard + + //update a simcard } else if (isset($_POST["update"])) { $simcard->check($_POST['id'], UPDATE); $simcard->update($_POST); @@ -99,9 +99,9 @@ } else if (isset($_GET["unglobalize"])) { $simcard->check($_GET["id"], UPDATE); - //TODO There is probably a bug here... + //TODO There is probably a bug here... Html::redirect(Toolbox::getItemTypeFormURL('PluginSimcardSimcard')."?id=".$_GET["id"]); - + } else {//print simcard information // Affichage du fil d'Ariane Html::header(PluginSimcardSimcard::getTypeName(2), '', "assets", "pluginsimcardsimcard", "simcard"); diff --git a/front/simcard.php b/front/simcard.php index ede1058..95ea5a7 100644 --- a/front/simcard.php +++ b/front/simcard.php @@ -34,7 +34,7 @@ Html::header(PluginSimcardSimcard::getTypeName(2), '', "assets", "pluginsimcardsimcard", "simcard"); $simcard = new PluginSimcardSimcard(); -// TODO Is Checking canCreate useful before showing a list ? +// TODO Is Checking canCreate useful before showing a list ? if (PluginSimcardSimcard::canView() || PluginSimcardSimcard::canCreate()) { Search::show("PluginSimcardSimcard"); } else { diff --git a/front/simcard_item.form.php b/front/simcard_item.form.php index 2130ac6..5d2fa05 100644 --- a/front/simcard_item.form.php +++ b/front/simcard_item.form.php @@ -34,7 +34,7 @@ $simcard_item = new PluginSimcardSimcard_Item(); if (isset($_POST["additem"])) { - $simcard_item->can(-1, CREATE, $_POST); + $simcard_item->can(-1, CREATE, $_POST); if ($newID = $simcard_item->add($_POST)) { } } else if (isset($_POST["delete_items"])) { diff --git a/hook.php b/hook.php index 28a8587..6316e43 100644 --- a/hook.php +++ b/hook.php @@ -29,30 +29,29 @@ ---------------------------------------------------------------------- */ /** - * + * * Determine if the plugin should be installed or upgraded - * + * * Returns 0 if the plugin is not yet installed * Returns 1 if the plugin is already installed - * + * * @since 1.3 - * + * * @return number */ function plugin_simcard_currentVersion() { - + // Saves the current version to not re-detect it on multiple calls static $currentVersion = null; - + if ($currentVersion === null) { // result not cached - if ( - !TableExists('glpi_plugin_simcard_simcards_items') && + if (!TableExists('glpi_plugin_simcard_simcards_items') && !TableExists('glpi_plugin_simcard_configs') ) { // the plugin seems not installed $currentVersion = 0; - } else { + } else { if (TableExists('glpi_plugin_simcard_configs')) { // The plugin is at least 1.3 // Get the current version in the plugin's configuration @@ -77,9 +76,9 @@ function plugin_simcard_install() { include_once (GLPI_ROOT."/plugins/simcard/inc/phoneoperator.class.php"); include_once (GLPI_ROOT."/plugins/simcard/inc/simcard_item.class.php"); include_once (GLPI_ROOT."/plugins/simcard/inc/config.class.php"); - + $migration = new Migration(PLUGIN_SIMCARD_VERSION); - + if (plugin_simcard_currentVersion() == 0) { // Installation of the plugin PluginSimcardConfig::install($migration); @@ -99,7 +98,7 @@ function plugin_simcard_install() { PluginSimcardSimcardType::upgrade($migration); PluginSimcardPhoneOperator::upgrade($migration); PluginSimcardSimcard_Item::upgrade($migration); - + } return true; } @@ -113,7 +112,7 @@ function plugin_simcard_uninstall() { include_once (GLPI_ROOT."/plugins/simcard/inc/phoneoperator.class.php"); include_once (GLPI_ROOT."/plugins/simcard/inc/simcard_item.class.php"); include_once (GLPI_ROOT."/plugins/simcard/inc/config.class.php"); - + PluginSimcardProfile::uninstall(); PluginSimcardSimcard::uninstall(); PluginSimcardSimcardSize::uninstall(); @@ -160,7 +159,7 @@ function plugin_simcard_getDropdown() { $plugin = new Plugin(); if ($plugin->isActivated("simcard")) { - return array('PluginSimcardSimcardSize' => __('Size', 'simcard'), + return array('PluginSimcardSimcardSize' => __('Size', 'simcard'), 'PluginSimcardPhoneOperator' => __('Provider', 'simcard'), 'PluginSimcardSimcardVoltage' => __('Voltage', 'simcard'), 'PluginSimcardSimcardType' => __('Type of SIM card', 'simcard')); @@ -197,13 +196,13 @@ function plugin_simcard_forceGroupBy($type) { function plugin_simcard_getAddSearchOptions($itemtype) { global $LANG; - + $sopt = array(); $reservedTypeIndex = PluginSimcardConfig::RESERVED_TYPE_RANGE_MIN; - - if (in_array($itemtype,PluginSimcardSimcard_Item::getClasses())) { - if (PluginSimcardSimcard::canView()) { + + if (in_array($itemtype, PluginSimcardSimcard_Item::getClasses())) { + if (PluginSimcardSimcard::canView()) { $sopt[$reservedTypeIndex]['table'] = 'glpi_plugin_simcard_simcards'; $sopt[$reservedTypeIndex]['field'] = 'name'; $sopt[$reservedTypeIndex]['name'] = _sn('SIM card', 'SIM cards', 2, 'simcard')." - ".__s('Name'); @@ -212,8 +211,8 @@ function plugin_simcard_getAddSearchOptions($itemtype) { $sopt[$reservedTypeIndex]['datatype'] = 'itemlink'; $sopt[$reservedTypeIndex]['itemlink_type'] = 'PluginSimcardSimcard'; $sopt[$reservedTypeIndex]['joinparams'] = array('beforejoin' - => array('table' => 'glpi_plugin_simcard_simcards_items', - 'joinparams' => array('jointype' => 'itemtype_item'))); + => array('table' => 'glpi_plugin_simcard_simcards_items', + 'joinparams' => array('jointype' => 'itemtype_item'))); $reservedTypeIndex++; $sopt[$reservedTypeIndex]['table'] = 'glpi_plugin_simcard_simcards'; $sopt[$reservedTypeIndex]['field'] = 'phonenumber'; @@ -221,8 +220,8 @@ function plugin_simcard_getAddSearchOptions($itemtype) { $sopt[$reservedTypeIndex]['massiveaction'] = false; $sopt[$reservedTypeIndex]['forcegroupby'] = true; $sopt[$reservedTypeIndex]['joinparams'] = array('beforejoin' - => array('table' => 'glpi_plugin_simcard_simcards_items', - 'joinparams' => array('jointype' => 'itemtype_item'))); + => array('table' => 'glpi_plugin_simcard_simcards_items', + 'joinparams' => array('jointype' => 'itemtype_item'))); $reservedTypeIndex++; $sopt[$reservedTypeIndex]['table'] = 'glpi_plugin_simcard_simcards'; $sopt[$reservedTypeIndex]['field'] = 'serial'; @@ -230,9 +229,9 @@ function plugin_simcard_getAddSearchOptions($itemtype) { $sopt[$reservedTypeIndex]['massiveaction'] = false; $sopt[$reservedTypeIndex]['forcegroupby'] = true; $sopt[$reservedTypeIndex]['joinparams'] = array('beforejoin' - => array('table' => 'glpi_plugin_simcard_simcards_items', - 'joinparams' => array('jointype' => 'itemtype_item'))); - } + => array('table' => 'glpi_plugin_simcard_simcards_items', + 'joinparams' => array('jointype' => 'itemtype_item'))); + } } return $sopt; } @@ -250,17 +249,17 @@ function plugin_item_purge_simcard($item) { function plugin_datainjection_populate_simcard() { global $INJECTABLE_TYPES; - + $INJECTABLE_TYPES['PluginSimcardSimcardInjection'] = 'simcard'; } /** - * + * * Determine if the plugin should be installed or upgraded - * + * * Returns 0 if the plugin is not yet installed * Returns 1 if the plugin is already installed - * + * * @since 1.3 */ function plugin_simcard_postinit() { @@ -279,9 +278,9 @@ function plugin_simcard_postinit() { /** * Update helpdesk_item_type in a profile if a ProfileRight changes or is created - * + * * Add or remove simcard item type to match the status of "associable to tickets" in simcard's right - * + * * @since 1.4.1 */ function plugin_simcard_profileRightUpdate($item) { @@ -321,4 +320,3 @@ function plugin_simcard_profileRightUpdate($item) { } } } -?> diff --git a/inc/config.class.php b/inc/config.class.php index 7c93cbb..e86357b 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -27,13 +27,13 @@ @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ - - if (!defined('GLPI_ROOT')) { + +if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } /** - * + * * @author dethegeek * @since 1.3 * @@ -44,17 +44,17 @@ class PluginSimcardConfig extends CommonDBTM { // Reserved range : [10126, 10135] const RESERVED_TYPE_RANGE_MIN = 10126; const RESERVED_TYPE_RANGE_MAX = 10135; - + static $config = array(); /** - * * - * + * + * **/ static function install(Migration $migration) { global $DB; - + $table = getTableForItemType(__CLASS__); $query = "CREATE TABLE `".$table."` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -68,23 +68,23 @@ static function install(Migration $migration) { (`type`,`value`) VALUES ('Version', '" . PLUGIN_SIMCARD_VERSION . "')"; $DB->query($query) or die($DB->error()); - + } - + /** - * * - * + * + * **/ static function upgrade(Migration $migration) { global $DB; - + switch (plugin_simcard_currentVersion()) { - case '1.2': - self::install($migration); - break; + case '1.2': + self::install($migration); + break; - default: + default: $table = getTableForItemType(__CLASS__); $query = "UPDATE `".$table."` SET `value`= '" . PLUGIN_SIMCARD_VERSION . "' @@ -92,15 +92,15 @@ static function upgrade(Migration $migration) { $DB->query($query) or die($DB->error()); } } - + /** - * * - * + * + * **/ static function uninstall() { global $DB; - + $displayPreference = new DisplayPreference(); $displayPreference->deleteByCriteria(array("`num` >= " . self::RESERVED_TYPE_RANGE_MIN . " AND `num` <= " . self::RESERVED_TYPE_RANGE_MAX)); @@ -111,13 +111,13 @@ static function uninstall() { } /** - * * - * + * + * **/ static function loadCache() { global $DB; - + $table = getTableForItemType(__CLASS__); self::$config = array(); $query = "SELECT * FROM `". $table ."`"; @@ -163,7 +163,7 @@ function getValue($name) { } return NULL; } - + /** * Update configuration value * diff --git a/inc/phoneoperator.class.php b/inc/phoneoperator.class.php index 19fc82d..f3665ea 100644 --- a/inc/phoneoperator.class.php +++ b/inc/phoneoperator.class.php @@ -42,7 +42,7 @@ static function getTypeName($nb=0) { static function install(Migration $migration) { global $DB; - + $table = getTableForItemType(__CLASS__); if (!TableExists($table)) { $query = "CREATE TABLE IF NOT EXISTS `$table` ( @@ -55,9 +55,9 @@ static function install(Migration $migration) { $DB->query($query) or die($DB->error()); } } - + /** - * + * * * @since 1.3 **/ @@ -65,15 +65,15 @@ static function upgrade(Migration $migration) { global $DB; } - + static function uninstall() { global $DB; - + foreach (array('DisplayPreference', 'Bookmark') as $itemtype) { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); } - + // Remove dropdowns localization $dropdownTranslation = new DropdownTranslation(); $dropdownTranslation->deleteByCriteria(array("itemtype LIKE 'PluginSimcardPhoneOperator'"), 1); @@ -113,4 +113,3 @@ static function transfer($ID, $entity) { return 0; } } -?> diff --git a/inc/profile.class.php b/inc/profile.class.php index 85e5b67..bcc2721 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -28,7 +28,7 @@ @since 2009 ---------------------------------------------------------------------- */ -if (!defined('GLPI_ROOT')){ +if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } @@ -36,35 +36,35 @@ class PluginSimcardProfile extends Profile { const RIGHT_SIMCARD_SIMCARD = "simcard:simcard"; const SIMCARD_ASSOCIATE_TICKET = 128; - - static $rightname = 'profile'; + + static $rightname = 'profile'; function createAccess($ID) { $this->add(array('profiles_id' => $ID)); } - + static function createFirstAccess($ID) { $profileRight = new ProfileRight(); - + $currentRights = ProfileRight::getProfileRights( - $ID, - array(self::RIGHT_SIMCARD_SIMCARD) + $ID, + array(self::RIGHT_SIMCARD_SIMCARD) ); $firstAccessRights = array_merge($currentRights, array( - self::RIGHT_SIMCARD_SIMCARD => ALLSTANDARDRIGHT - + self::SIMCARD_ASSOCIATE_TICKET - + READNOTE - + UPDATENOTE + self::RIGHT_SIMCARD_SIMCARD => ALLSTANDARDRIGHT + + self::SIMCARD_ASSOCIATE_TICKET + + READNOTE + + UPDATENOTE )); $profileRight->updateProfileRights($ID, $firstAccessRights); //Add right to the current session $_SESSION['glpiactiveprofile'][self::RIGHT_SIMCARD_SIMCARD] = $firstAccessRights[self::RIGHT_SIMCARD_SIMCARD]; $_SESSION['glpiactiveprofile']['helpdesk_item_type'][] = 'PluginSimcardSimcard'; - } - + } + //profiles modification - function showForm($ID, $options = array()){ + function showForm($ID, $options = array()) { global $LANG; if (!Profile::canView()) { @@ -72,18 +72,18 @@ function showForm($ID, $options = array()){ } $canedit = self::canUpdate(); $profile = new Profile(); - if ($ID){ + if ($ID) { //$this->getFromDBByProfile($ID); $profile->getFromDB($ID); } if ($canedit) { - echo "
"; + echo ""; } - + $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2')); - + if ($canedit) { echo "
"; echo ""; @@ -93,55 +93,55 @@ function showForm($ID, $options = array()){ Html::closeForm(); $this->showLegend(); } - + static function install(Migration $migration) { global $DB; - + // Table no longer needed in GLPI 0.85+; drop it. Needed for upgrades $migration->dropTable(getTableForItemType(__CLASS__)); PluginSimcardProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); } - + /** - * + * * * @since 1.3 **/ static function upgrade(Migration $migration) { global $DB; - + $table = getTableForItemType(__CLASS__); switch (plugin_simcard_currentVersion()) { - case '1.3': - case '1.3.1': - $query = "SELECT * FROM `glpi_plugin_simcard_profiles`"; - $result = $DB->query($query); - while ($data = $DB->fetch_assoc($result)) { - // Write the access rights into the new ACLs system of GLPI 0.85 - $translatedRight = self::translateARight($data['simcard']) + self::translateARight($data['open_ticket']); - if ($translatedRight & READ) { - $translatedRight = $translatedRight | READNOTE; - } - if ($translatedRight & UPDATE) { - $translatedRight = $translatedRight | READNOTE | UPDATENOTE; - } - $profileRight = new ProfileRight(); - $profileRightFields['profiles_id'] = $data['profiles_id']; - $profileRightFields['name'] = self::RIGHT_SIMCARD_SIMCARD; - $profileRightFields['rights'] = $translatedRight; - if ($profileRight->add($profileRightFields) === false) { - die('Fatal error migrating profile rights'); - } - // The plugin is not yet active, the hook will not trigger automatically - plugin_simcard_profileRightUpdate($profileRight); - } - $query = "DROP TABLE `glpi_plugin_simcard_profiles`"; - $DB->query($query) or die($DB->error()); - break; - - case '1.4': - case '1.4.1': - + case '1.3': + case '1.3.1': + $query = "SELECT * FROM `glpi_plugin_simcard_profiles`"; + $result = $DB->query($query); + while ($data = $DB->fetch_assoc($result)) { + // Write the access rights into the new ACLs system of GLPI 0.85 + $translatedRight = self::translateARight($data['simcard']) + self::translateARight($data['open_ticket']); + if ($translatedRight & READ) { + $translatedRight = $translatedRight | READNOTE; + } + if ($translatedRight & UPDATE) { + $translatedRight = $translatedRight | READNOTE | UPDATENOTE; + } + $profileRight = new ProfileRight(); + $profileRightFields['profiles_id'] = $data['profiles_id']; + $profileRightFields['name'] = self::RIGHT_SIMCARD_SIMCARD; + $profileRightFields['rights'] = $translatedRight; + if ($profileRight->add($profileRightFields) === false) { + die('Fatal error migrating profile rights'); + } + // The plugin is not yet active, the hook will not trigger automatically + plugin_simcard_profileRightUpdate($profileRight); + } + $query = "DROP TABLE `glpi_plugin_simcard_profiles`"; + $DB->query($query) or die($DB->error()); + break; + + case '1.4': + case '1.4.1': + } } @@ -149,25 +149,25 @@ static function upgrade(Migration $migration) { * Init profiles * **/ - + static function translateARight($old_right) { - switch ($old_right) { - case 'r' : - return READ; - - case 'w': - return ALLSTANDARDRIGHT; - - case '1': - return self::SIMCARD_ASSOCIATE_TICKET; - - case '0': - case '': - default: - return 0; - } + switch ($old_right) { + case 'r' : + return READ; + + case 'w': + return ALLSTANDARDRIGHT; + + case '1': + return self::SIMCARD_ASSOCIATE_TICKET; + + case '0': + case '': + default: + return 0; + } } - + static function uninstall() { global $DB; @@ -187,7 +187,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { - + if ($item->getType() == 'Profile') { $profile = new self(); $profile->showForm($item->getField('id')); @@ -207,4 +207,3 @@ function getAllRights() { } -?> \ No newline at end of file diff --git a/inc/simcard.class.php b/inc/simcard.class.php index be0a7b6..8762628 100644 --- a/inc/simcard.class.php +++ b/inc/simcard.class.php @@ -37,14 +37,14 @@ class PluginSimcardSimcard extends CommonDBTM { // From CommonDBTM //static $types = array(''); - public $dohistory = true; - - static $rightname = PluginSimcardProfile::RIGHT_SIMCARD_SIMCARD; - protected $usenotepad = true; - - //~ static $types = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer', 'Software', 'Entity'); - static $types = array('Phone' , 'Entity'); - + public $dohistory = true; + + static $rightname = PluginSimcardProfile::RIGHT_SIMCARD_SIMCARD; + protected $usenotepad = true; + + //~ static $types = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer', 'Software', 'Entity'); + static $types = array('Phone' , 'Entity'); + /** * Name of the type * @@ -63,8 +63,8 @@ static function getTypeName($nb=0) { function getRights($interface='central') { $rights = parent::getRights(); $rights[PluginSimcardProfile::SIMCARD_ASSOCIATE_TICKET] = __('Associable to a ticket'); - - return $rights; + + return $rights; } function defineTabs($options=array()) { @@ -75,22 +75,22 @@ function defineTabs($options=array()) { if (!isset($options['withtemplate']) || empty($options['withtemplate'])) { $this->addStandardTab('PluginSimcardSimcard_Item', $ong, $options); $this->addStandardTab('NetworkPort', $ong, $options); - $this->addStandardTab('Document_Item',$ong,$options); - $this->addStandardTab('Infocom',$ong,$options); + $this->addStandardTab('Document_Item', $ong, $options); + $this->addStandardTab('Infocom', $ong, $options); $this->addStandardTab('Contract_Item', $ong, $options); if ($this->fields['is_helpdesk_visible'] == 1) { - $this->addStandardTab('Ticket',$ong,$options); + $this->addStandardTab('Ticket', $ong, $options); $this->addStandardTab('Item_Problem', $ong, $options); } - $this->addStandardTab('Notepad',$ong,$options); - $this->addStandardTab('Log',$ong,$options); - $this->addStandardTab('Event',$ong,$options); + $this->addStandardTab('Notepad', $ong, $options); + $this->addStandardTab('Log', $ong, $options); + $this->addStandardTab('Event', $ong, $options); } else { - $this->addStandardTab('Infocom',$ong,$options); + $this->addStandardTab('Infocom', $ong, $options); $this->addStandardTab('Contract_Item', $ong, $options); - $this->addStandardTab('Document_Item',$ong,$options); - $this->addStandardTab('Log',$ong,$options); - $this->addStandardTab('Event',$ong,$options); + $this->addStandardTab('Document_Item', $ong, $options); + $this->addStandardTab('Log', $ong, $options); + $this->addStandardTab('Event', $ong, $options); } } else { $ong[1] = __s('Main'); @@ -109,16 +109,18 @@ function defineTabs($options=array()) { * *@return Nothing (display) **/ - function showForm($ID, $options=array()) { + function showForm($ID, $options=array()) { global $CFG_GLPI, $DB, $LANG; - if (!$this->canView()) return false; - + if (!$this->canView()) { + return false; + } + $target = $this->getFormURL(); $withtemplate = ''; if (isset($options['target'])) { - $target = $options['target']; + $target = $options['target']; } if (isset($options['withtemplate'])) { @@ -139,16 +141,15 @@ function showForm($ID, $options=array()) { echo ""; echo ""; } - - + echo ""; echo "".__s('Name'). - (isset($options['withtemplate']) && $options['withtemplate']?"*":""). - ""; + (isset($options['withtemplate']) && $options['withtemplate']?"*":""). + ""; echo ""; $objectName = autoName($this->fields["name"], "name", - (isset($options['withtemplate']) && $options['withtemplate']==2), - $this->getType(), $this->fields["entities_id"]); + (isset($options['withtemplate']) && $options['withtemplate']==2), + $this->getType(), $this->fields["entities_id"]); Html::autocompletionTextField($this, 'name', array('value' => $objectName)); echo ""; echo "".__s('Status').""; @@ -160,29 +161,29 @@ function showForm($ID, $options=array()) { echo "".__s('Location').""; echo ""; Dropdown::show('Location', array('value' => $this->fields["locations_id"], - 'entity' => $this->fields["entities_id"])); + 'entity' => $this->fields["entities_id"])); echo ""; echo "".__s('Type of SIM card', 'simcard').""; echo ""; Dropdown::show('PluginSimcardSimcardType', - array('value' => $this->fields["plugin_simcard_simcardtypes_id"])); + array('value' => $this->fields["plugin_simcard_simcardtypes_id"])); echo "\n"; echo ""; echo "".__s('Technician in charge of the hardware').""; echo ""; User::dropdown(array('name' => 'users_id_tech', - 'value' => $this->fields["users_id_tech"], - 'right' => 'interface', - 'entity' => $this->fields["entities_id"])); + 'value' => $this->fields["users_id_tech"], + 'right' => 'interface', + 'entity' => $this->fields["entities_id"])); echo ""; echo "".__s('Size', 'simcard').""; echo ""; Dropdown::show('PluginSimcardSimcardSize', - array('value' => $this->fields["plugin_simcard_simcardsizes_id"])); + array('value' => $this->fields["plugin_simcard_simcardsizes_id"])); echo "\n"; -// TODO : Add group in charge of hardware + // TODO : Add group in charge of hardware echo ""; echo "".__s('Group in charge of the hardware').""; echo ""; @@ -191,56 +192,55 @@ function showForm($ID, $options=array()) { 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`')); echo ""; - + echo "".__s('Voltage', 'simcard').""; echo ""; Dropdown::show('PluginSimcardSimcardVoltage', - array('value' => $this->fields["plugin_simcard_simcardvoltages_id"])); + array('value' => $this->fields["plugin_simcard_simcardvoltages_id"])); echo "\n"; - + echo ""; echo "".__s('Provider', 'simcard').""; echo ""; Dropdown::show('PluginSimcardPhoneOperator', - array('value' => $this->fields["plugin_simcard_phoneoperators_id"])); + array('value' => $this->fields["plugin_simcard_phoneoperators_id"])); echo ""; echo "" . __s('Associable items to a ticket') . " :"; - Dropdown::showYesNo('is_helpdesk_visible',$this->fields['is_helpdesk_visible']); + Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']); echo "\n"; - - + echo ""; echo "".__s('User').""; echo ""; User::dropdown(array('value' => $this->fields["users_id"], - 'entity' => $this->fields["entities_id"], - 'right' => 'all')); + 'entity' => $this->fields["entities_id"], + 'right' => 'all')); echo ""; echo ""; - + echo "".__s("Inventory number"). - (isset($options['withtemplate']) && $options['withtemplate']?"*":""). - ""; + (isset($options['withtemplate']) && $options['withtemplate']?"*":""). + ""; echo ""; $objectName = autoName($this->fields["otherserial"], "otherserial", - (isset($options['withtemplate']) && $options['withtemplate']==2), - $this->getType(), $this->fields["entities_id"]); + (isset($options['withtemplate']) && $options['withtemplate']==2), + $this->getType(), $this->fields["entities_id"]); Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName)); echo "\n"; echo ""; echo "".__s('Group').""; echo ""; Dropdown::show('Group', array('value' => $this->fields["groups_id"], - 'entity' => $this->fields["entities_id"])); + 'entity' => $this->fields["entities_id"])); echo "\n"; - + echo ""; echo "".__s('Phone number', 'simcard').""; echo ""; - Html::autocompletionTextField($this,'phonenumber'); + Html::autocompletionTextField($this, 'phonenumber'); echo ""; echo "".__s('Comments').""; echo ""; @@ -250,33 +250,33 @@ function showForm($ID, $options=array()) { echo ""; echo "".__s('IMSI', 'simcard').""; echo ""; - Html::autocompletionTextField($this,'serial'); + Html::autocompletionTextField($this, 'serial'); echo "\n"; - + //Only show PIN and PUK code to users who can write (theses informations are highly sensible) if (PluginSimcardSimcard::canUpdate()) { echo ""; echo "".__s('Pin 1', 'simcard').""; echo ""; - Html::autocompletionTextField($this,'pin'); + Html::autocompletionTextField($this, 'pin'); echo "\n"; - + echo ""; echo "".__s('Pin 2', 'simcard').""; echo ""; - Html::autocompletionTextField($this,'pin2'); + Html::autocompletionTextField($this, 'pin2'); echo "\n"; - + echo ""; echo "".__s('Puk 1', 'simcard').""; echo ""; - Html::autocompletionTextField($this,'puk'); + Html::autocompletionTextField($this, 'puk'); echo "\n"; echo ""; echo "".__s('Puk 2', 'simcard').""; echo ""; - Html::autocompletionTextField($this,'puk2'); + Html::autocompletionTextField($this, 'puk2'); echo "\n"; } @@ -296,7 +296,7 @@ function prepareInputForAdd($input) { return $input; } - + function post_addItem() { global $DB, $CFG_GLPI; @@ -304,9 +304,9 @@ function post_addItem() { if (isset($this->input["_oldID"])) { Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']); Contract_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']); - Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']); + Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']); } - + if (isset($this->input['_itemtype']) && isset($this->input['_items_id'])) { $simcard_item = new PluginSimcardSimcard_Item(); $tmp['plugin_simcard_simcards_id'] = $this->getID(); @@ -314,10 +314,10 @@ function post_addItem() { $tmp['items_id'] = $this->input['_items_id']; $simcard_item->add($tmp); } - + } - - function getSearchOptions() { + + function getSearchOptions() { global $CFG_GLPI, $LANG; $tab = array(); @@ -332,13 +332,13 @@ function getSearchOptions() { $tab[1]['injectable'] = true; $tab[1]['checktype'] = 'text'; $tab[1]['displaytype'] = 'text'; - + $tab[2]['table'] = $this->getTable(); $tab[2]['field'] = 'id'; $tab[2]['name'] = __('ID'); $tab[2]['massiveaction'] = false; // implicit field is id $tab[2]['injectable'] = false; - + $tab[4]['table'] = 'glpi_plugin_simcard_simcardtypes'; $tab[4]['field'] = 'name'; $tab[4]['name'] = __('Type'); @@ -347,7 +347,7 @@ function getSearchOptions() { $tab[4]['checktype'] = 'text'; $tab[4]['displaytype'] = 'dropdown'; $tab[4]['injectable'] = true; - + $tab[5]['table'] = $this->getTable(); $tab[5]['field'] = 'serial'; $tab[5]['name'] = __('IMSI', 'simcard'); @@ -355,7 +355,7 @@ function getSearchOptions() { $tab[5]['checktype'] = 'text'; $tab[5]['displaytype'] = 'text'; $tab[5]['injectable'] = true; - + $tab[6]['table'] = $this->getTable(); $tab[6]['field'] = 'otherserial'; $tab[6]['name'] = __('Inventory number'); @@ -363,7 +363,7 @@ function getSearchOptions() { $tab[6]['checktype'] = 'text'; $tab[6]['displaytype'] = 'text'; $tab[6]['injectable'] = true; - + $tab[16]['table'] = $this->getTable(); $tab[16]['field'] = 'comment'; $tab[16]['name'] = __('Comments'); @@ -372,14 +372,14 @@ function getSearchOptions() { $tab[16]['checktype'] = 'text'; $tab[16]['displaytype'] = 'multiline_text'; $tab[16]['injectable'] = true; - + $tab += Location::getSearchOptionsToAdd(); $tab += Notepad::getSearchOptionsToAdd(); $tab[3]['checktype'] = 'text'; $tab[3]['displaytype'] = 'dropdown'; $tab[3]['injectable'] = true; - + $tab[91]['injectable'] = false; $tab[93]['injectable'] = false; @@ -389,7 +389,7 @@ function getSearchOptions() { $tab[19]['datatype'] = 'datetime'; $tab[19]['massiveaction'] = false; $tab[19]['injectable'] = false; - + // TODO : This index has not any similar in GLPI, should find an other index $tab[23]['table'] = 'glpi_plugin_simcard_simcardvoltages'; $tab[23]['field'] = 'name'; @@ -398,7 +398,7 @@ function getSearchOptions() { $tab[23]['checktype'] = 'text'; $tab[23]['displaytype'] = 'dropdown'; $tab[23]['injectable'] = true; - + $tab[24]['table'] = 'glpi_users'; $tab[24]['field'] = 'name'; $tab[24]['linkfield'] = 'users_id_tech'; @@ -416,7 +416,7 @@ function getSearchOptions() { $tab[25]['checktype'] = 'text'; $tab[25]['displaytype'] = 'dropdown'; $tab[25]['injectable'] = true; - + $tab[26]['table'] = 'glpi_plugin_simcard_phoneoperators'; $tab[26]['field'] = 'name'; $tab[26]['name'] = __('Provider', 'simcard'); @@ -424,7 +424,7 @@ function getSearchOptions() { $tab[26]['checktype'] = 'text'; $tab[26]['displaytype'] = 'dropdown'; $tab[26]['injectable'] = true; - + $tab[27]['table'] = $this->getTable(); $tab[27]['field'] = 'phonenumber'; $tab[27]['name'] = __('Phone number', 'simcard'); @@ -432,7 +432,7 @@ function getSearchOptions() { $tab[27]['checktype'] = 'text'; $tab[27]['displaytype'] = 'text'; $tab[27]['injectable'] = true; - + if (PluginSimcardSimcard::canUpdate()) { $tab[28]['table'] = $this->getTable(); $tab[28]['field'] = 'pin'; @@ -441,7 +441,7 @@ function getSearchOptions() { $tab[28]['checktype'] = 'text'; $tab[28]['displaytype'] = 'text'; $tab[28]['injectable'] = true; - + $tab[29]['table'] = $this->getTable(); $tab[29]['field'] = 'puk'; $tab[29]['name'] = __('Puk 1', 'simcard'); @@ -457,7 +457,7 @@ function getSearchOptions() { $tab[30]['checktype'] = 'text'; $tab[30]['displaytype'] = 'text'; $tab[30]['injectable'] = true; - + $tab[32]['table'] = $this->getTable(); $tab[32]['field'] = 'puk2'; $tab[32]['name'] = __('Puk 2', 'simcard'); @@ -474,7 +474,7 @@ function getSearchOptions() { $tab[31]['checktype'] = 'text'; $tab[31]['displaytype'] = 'dropdown'; $tab[31]['injectable'] = true; - + $tab[71]['table'] = 'glpi_groups'; $tab[71]['field'] = 'completename'; $tab[71]['name'] = __('Group'); @@ -482,7 +482,7 @@ function getSearchOptions() { $tab[71]['checktype'] = 'text'; $tab[71]['displaytype'] = 'dropdown'; $tab[71]['injectable'] = true; - + $tab[49]['table'] = 'glpi_groups'; $tab[49]['field'] = 'name'; $tab[49]['linkfield'] = 'groups_id_tech'; @@ -492,7 +492,7 @@ function getSearchOptions() { $tab[49]['checktype'] = 'text'; $tab[49]['displaytype'] = 'dropdown'; $tab[49]['injectable'] = true; - + $tab[70]['table'] = 'glpi_users'; $tab[70]['field'] = 'name'; $tab[70]['name'] = __('User'); @@ -501,12 +501,12 @@ function getSearchOptions() { $tab[70]['checktype'] = 'text'; $tab[70]['displaytype'] = 'dropdown'; $tab[70]['injectable'] = true; - + $tab[80]['table'] = 'glpi_entities'; $tab[80]['field'] = 'completename'; $tab[80]['name'] = __('Entity'); $tab[80]['injectable'] = false; - + $tab[90]['table'] = $this->getTable(); $tab[90]['field'] = 'notepad'; $tab[90]['name'] = __('Notes'); @@ -515,13 +515,13 @@ function getSearchOptions() { $tab[90]['checktype'] = 'text'; $tab[90]['displaytype'] = 'multiline_text'; $tab[90]['injectable'] = false; - + return $tab; } - + /** * Installation of the itemtype - * + * * @param Migration $migration migration helper instance */ static function install(Migration $migration) { @@ -582,44 +582,44 @@ static function install(Migration $migration) { $DB->query($query) or die("Error adding table $table"); } } - + static function upgrade(Migration $migration) { global $DB; - + switch (plugin_simcard_currentVersion()) { - case '1.2': - $sql = "ALTER TABLE `glpi_plugin_simcard_simcards` + case '1.2': + $sql = "ALTER TABLE `glpi_plugin_simcard_simcards` ADD `plugin_simcard_simcardtypes_id` int(11) NOT NULL DEFAULT '0' AFTER `plugin_simcard_simcardvoltages_id`, ADD `groups_id_tech` int(11) NOT NULL DEFAULT '0' AFTER `groups_id`"; - - $DB->query($sql) or die($DB->error()); - break; - - case '1.3': - case '1.3.1': - case '1.4': - // Migrate notepad data - if (FieldExists('glpi_plugin_simcard_simcards', 'notepad')) { - $query = "SELECT id, notepad + + $DB->query($sql) or die($DB->error()); + break; + + case '1.3': + case '1.3.1': + case '1.4': + // Migrate notepad data + if (FieldExists('glpi_plugin_simcard_simcards', 'notepad')) { + $query = "SELECT id, notepad FROM `glpi_plugin_simcard_simcards` WHERE notepad IS NOT NULL AND notepad <> ''"; - foreach ($DB->request($query) as $data) { - $iq = "INSERT INTO `glpi_notepads` + foreach ($DB->request($query) as $data) { + $iq = "INSERT INTO `glpi_notepads` (`itemtype`, `items_id`, `content`, `date`, `date_mod`) VALUES ('".getItemTypeForTable('glpi_plugin_simcard_simcards')."', '".$data['id']."', '".addslashes($data['notepad'])."', NOW(), NOW())"; - $DB->queryOrDie($iq, "0.85 migrate notepad data"); - } - $sql = "ALTER TABLE `glpi_plugin_simcard_simcards` + $DB->queryOrDie($iq, "0.85 migrate notepad data"); + } + $sql = "ALTER TABLE `glpi_plugin_simcard_simcards` DROP `notepad`"; - - $DB->query($sql) or die($DB->error()); - } - break; + + $DB->query($sql) or die($DB->error()); + } + break; } } - + static function uninstall() { global $DB; @@ -630,7 +630,7 @@ static function uninstall() { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); } - + $plugin = new Plugin(); if ($plugin->isActivated('datainjection') && class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => __CLASS__)); @@ -639,7 +639,7 @@ static function uninstall() { if ($plugin->isInstalled('customfields') && $plugin->isActivated('customfields')) { PluginCustomfieldsItemtype::unregisterItemtype('PluginSimcardSimcard'); } - + $table = getTableForItemType(__CLASS__); $DB->query("DROP TABLE IF EXISTS `$table`"); } @@ -650,29 +650,29 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { if (in_array(get_class($item), PluginSimcardSimcard_Item::getClasses()) || get_class($item) == 'Profile') { return array(1 => _sn('SIM card', 'SIM cards', 2, 'simcard')); - } elseif (get_class($item) == __CLASS__) { + } else if (get_class($item) == __CLASS__) { return _sn('SIM card', 'SIM cards', 2, 'simcard'); } return ''; - } + } /** * Show tab content for a simcard item - * + * * @param CommonGLPI $item * @param number $tabnum * @param number $withtemplate */ static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { - + $self=new self(); - if($item->getType()=='PluginSimcardSimcard') { + if ($item->getType()=='PluginSimcardSimcard') { $self->showtotal($item->getField('id')); } return true; } - /** + /** * Type than could be linked to a Rack * * @param $all boolean, all type, or only allowed ones @@ -700,16 +700,16 @@ static function getTypes($all=false) { } return $types; } - + /** * Add menu entries the plugin needs to show - * + * * @return array */ static function getMenuContent() { - global $CFG_GLPI; - - $menu = array(); + global $CFG_GLPI; + + $menu = array(); $menu['title'] = self::getTypeName(2); $menu['page'] = self::getSearchURL(false); $menu['links']['search'] = self::getSearchURL(false); @@ -719,7 +719,7 @@ static function getMenuContent() { } return $menu; } - + /** * Actions done when item is deleted from the database @@ -745,17 +745,17 @@ function cleanDBonPurge() { function delete(array $input, $force=0, $history=1) { $deleteSuccessful = parent::delete($input, $force, $history); if ($deleteSuccessful != false) { - if ($force == 1) { - $notepad = new Notepad(); - $notepad->deleteByCriteria(array( - 'itemtype' => 'PluginSimcardSimcard', - 'items_id' => $input['id'] - )); - } + if ($force == 1) { + $notepad = new Notepad(); + $notepad->deleteByCriteria(array( + 'itemtype' => 'PluginSimcardSimcard', + 'items_id' => $input['id'] + )); + } } return $deleteSuccessful; } - + /** * @since version 0.85 * @@ -813,7 +813,7 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT $values["plugin_simcard_simcardtypes_id"] = $type; $item->update($values); } - + // Size $size = PluginSimcardSimcardSize::transfer($item->fields["plugin_simcard_simcardsizes_id"], $input['entities_id']); if ($size > 0) { @@ -821,7 +821,7 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT $values["plugin_simcard_simcardsizes_id"] = $size; $item->update($values); } - + // Voltage $voltage = PluginSimcardSimcardVoltage::transfer($item->fields["plugin_simcard_simcardvoltages_id"], $input['entities_id']); if ($voltage > 0) { @@ -829,7 +829,7 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT $values["plugin_simcard_simcardvoltages_id"] = $voltage; $item->update($values); } - + // Phoneoperator $phoneoperator = PluginSimcardPhoneOperator::transfer($item->fields["plugin_simcard_phoneoperators_id"], $input['entities_id']); if ($phoneoperator > 0) { @@ -855,4 +855,3 @@ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBT } } -?> diff --git a/inc/simcard_item.class.php b/inc/simcard_item.class.php index 2f414a8..664d50d 100644 --- a/inc/simcard_item.class.php +++ b/inc/simcard_item.class.php @@ -41,13 +41,13 @@ class PluginSimcardSimcard_Item extends CommonDBRelation{ static public $itemtype_2 = 'itemtype'; static public $items_id_2 = 'items_id'; - + // Itemtypes simcards may be linked to static protected $linkableClasses = array( - 'Computer', - 'Peripheral', - 'Phone', - 'Printer', + 'Computer', + 'Peripheral', + 'Phone', + 'Printer', 'NetworkEquipment' ); @@ -60,7 +60,7 @@ static function getTypeName($nb=0) { global $LANG; return __s('Direct Connections'); } - + /** * Check right on an item - overloaded to check is_global * @@ -90,23 +90,23 @@ function can($ID, $right, array &$input=NULL) { } static function countForItem($id) { - return countElementsInTable(getTableForItemType(__CLASS__), + return countElementsInTable(getTableForItemType(__CLASS__), "`plugin_simcard_simcards_id`='$id'"); } /** * Count the number of relations having the itemtype of $item - * + * * @param CommonDBTM $item Item whose relations to simcards shall be counted * @return integer count of relations between the item and simcards */ static function countForItemByItemtype(CommonDBTM $item) { $id = $item->getField('id'); $itemtype = $item->getType(); - return countElementsInTable(getTableForItemType(__CLASS__), - "`items_id`='$id' AND `itemtype`='$itemtype'"); + return countElementsInTable(getTableForItemType(__CLASS__), + "`items_id`='$id' AND `itemtype`='$itemtype'"); } - + /** * Hook called After an item is uninstall or purge */ @@ -116,11 +116,11 @@ static function cleanForItem(CommonDBTM $item) { array('itemtype' => $item->getType(), 'items_id' => $item->getField('id'))); } - + static function getClasses() { return self::$linkableClasses; } - + /** * Declare a new itemtype to be linkable to a simcard */ @@ -131,7 +131,7 @@ static function registerItemtype($itemtype) { array('addtabon' => $itemtype)); } } - + static function install(Migration $migration) { global $DB; $table = getTableForItemType(__CLASS__); @@ -148,9 +148,9 @@ static function install(Migration $migration) { $DB->query($query) or die ($DB->error()); } } - + /** - * + * * * @since 1.3 **/ @@ -158,7 +158,7 @@ static function upgrade(Migration $migration) { global $DB; } - + static function uninstall() { global $DB; $table = getTableForItemType(__CLASS__); @@ -167,7 +167,7 @@ static function uninstall() { static function showForSimcard(PluginSimcardSimcard $simcard) { global $DB, $LANG; - + if (!$simcard->canView()) { return false; } @@ -207,7 +207,7 @@ static function showForSimcard(PluginSimcardSimcard $simcard) { if (isset($item->fields['serial'])) { echo $item->fields['serial']; } else { - + } echo ""; echo ""; @@ -218,44 +218,44 @@ static function showForSimcard(PluginSimcardSimcard $simcard) { echo ""; } } - + if (PluginSimcardsimcard::canUpdate()) { echo ""; if (empty($results)) { echo ""; // TODO : Dropdown::showAllItems is deprecated, use Dropdown::showSelectItemFromItemtypes instead - Dropdown::showAllItems("items_id",0,0,$simcard->fields['entities_id'], self::getClasses()); + Dropdown::showAllItems("items_id", 0, 0, $simcard->fields['entities_id'], self::getClasses()); echo ""; echo ""; echo ""; echo ""; } - + if (!empty($results)) { Html::openArrowMassives('items', true); Html::closeArrowMassives(array('delete_items' => _sx('button', 'Disconnect'))); } } - echo "" ; + echo ""; Html::closeForm(); echo "
"; } - + static function showForItem(CommonDBTM $item) { global $DB, $LANG; - + if (!$item->canView()) { return false; } - -// if (PluginSimcardSimcard::canCreate()) { -// if ($item->canEdit($item->getField('id'))) { -// $url = Toolbox::getItemTypeFormURL('PluginSimcardSimcard'); -// $url.= "?itemtype=".$item->getType()."&items_id=".$item->getID()."&id=-1"; -// echo "
"; - -// } -// } + + // if (PluginSimcardSimcard::canCreate()) { + // if ($item->canEdit($item->getField('id'))) { + // $url = Toolbox::getItemTypeFormURL('PluginSimcardSimcard'); + // $url.= "?itemtype=".$item->getType()."&items_id=".$item->getID()."&id=-1"; + // echo "
"; + + // } + // } $results = getAllDatasFromTable(getTableForItemType(__CLASS__), "`items_id` = '".$item->getID()."' AND `itemtype`='".get_class($item)."'"); echo "
"; @@ -293,7 +293,7 @@ static function showForItem(CommonDBTM $item) { echo ""; } } - + if (PluginSimcardSimcard::canUpdate()) { echo ""; echo ""; @@ -314,20 +314,20 @@ static function showForItem(CommonDBTM $item) { echo ""; echo ""; echo ""; - + if (!empty($results)) { Html::openArrowMassives('items', true); Html::closeArrowMassives(array ('delete_items' => _sx('button', 'Disconnect'))); } } - echo "" ; + echo ""; Html::closeForm(); echo "
"; } function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { global $CFG_GLPI; - + if (PluginSimcardSimcard::canView()) { switch ($item->getType()) { case 'PluginSimcardSimcard' : @@ -347,28 +347,27 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { return ''; } - + /** - * + * * Count the number of associated items for a simcard item - * + * * @param $item Simcard object **/ static function countForSimcard(PluginSimcardSimcard $item) { - + $restrict = "`glpi_plugin_simcard_simcards_items`.`plugin_simcard_simcards_id` = '".$item->getField('id')."'"; - + return countElementsInTable(array('glpi_plugin_simcard_simcards_items'), $restrict); } - + static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { - + if (in_array(get_class($item), PluginSimcardSimcard_Item::getClasses())) { self::showForItem($item); - } elseif (get_class($item) == 'PluginSimcardSimcard') { + } else if (get_class($item) == 'PluginSimcardSimcard') { self::showForSimcard($item); } return true; } } -?> diff --git a/inc/simcardinjection.class.php b/inc/simcardinjection.class.php index f57ce07..e111b0f 100644 --- a/inc/simcardinjection.class.php +++ b/inc/simcardinjection.class.php @@ -28,7 +28,7 @@ @since 2009 ---------------------------------------------------------------------- */ -if (!defined('GLPI_ROOT')){ +if (!defined('GLPI_ROOT')) { die("Sorry. You can't access directly to this file"); } @@ -72,10 +72,9 @@ function getOptions($primary_type = '') { */ function addOrUpdateObject($values=array(), $options=array()) { - $lib = new PluginDatainjectionCommonInjectionLib($this,$values,$options); + $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options); $lib->processAddOrUpdate(); return $lib->getInjectionResults(); } } -?> diff --git a/inc/simcardsize.class.php b/inc/simcardsize.class.php index ca79fc6..87b7bed 100644 --- a/inc/simcardsize.class.php +++ b/inc/simcardsize.class.php @@ -53,7 +53,7 @@ static function install(Migration $migration) { KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; $DB->query($query) or die ("Error adding table $table"); - + $query = "INSERT INTO `$table` (`id`, `name`, `comment`) VALUES (1, 'Full-SIM', ''), (2, 'Micro-SIM', ''), @@ -62,9 +62,9 @@ static function install(Migration $migration) { $DB->query($query) or die("Error adding simcard sizes"); } } - + /** - * + * * * @since 1.3 **/ @@ -72,7 +72,7 @@ static function upgrade(Migration $migration) { global $DB; } - + static function uninstall() { global $DB; @@ -80,7 +80,7 @@ static function uninstall() { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); } - + // Remove dropdowns localization $dropdownTranslation = new DropdownTranslation(); $dropdownTranslation->deleteByCriteria(array("itemtype = 'PluginSimcardSimcardSize'"), 1); @@ -88,12 +88,12 @@ static function uninstall() { $table = getTableForItemType(__CLASS__); $DB->query("DROP TABLE IF EXISTS `$table`"); } - + static function transfer($ID, $entity) { global $DB; $simcardSize = new self(); - + if ($ID > 0) { // Not already transfer // Search init item @@ -120,4 +120,3 @@ static function transfer($ID, $entity) { return 0; } } -?> diff --git a/inc/simcardtype.class.php b/inc/simcardtype.class.php index 7cc9e21..adb3ade 100644 --- a/inc/simcardtype.class.php +++ b/inc/simcardtype.class.php @@ -58,7 +58,7 @@ static function install(Migration $migration) { } /** - * + * * * @since 1.3 * */ @@ -74,7 +74,7 @@ static function upgrade(Migration $migration) { static function uninstall() { global $DB; - + foreach (array('DisplayPreference', 'Bookmark') as $itemtype) { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); @@ -90,7 +90,7 @@ static function uninstall() { static function transfer($ID, $entity) { global $DB; - + $simcardType = new self(); if ($ID > 0) { @@ -121,4 +121,3 @@ static function transfer($ID, $entity) { } -?> diff --git a/inc/simcardvoltage.class.php b/inc/simcardvoltage.class.php index 069aa56..3dd95ad 100644 --- a/inc/simcardvoltage.class.php +++ b/inc/simcardvoltage.class.php @@ -43,7 +43,7 @@ static function getTypeName($nb=0) { static function install(Migration $migration) { global $DB; - + $table = getTableForItemType(__CLASS__); if (!TableExists($table)) { $query = "CREATE TABLE IF NOT EXISTS `$table` ( @@ -54,16 +54,16 @@ static function install(Migration $migration) { KEY `name` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; $DB->query($query) or die ("Error adding table $table"); - + $query = "INSERT INTO `$table` (`id`, `name`, `comment`) VALUES (1, '3V', ''), (2, '5V', '');"; $DB->query($query) or die("Error adding simcard voltages"); } } - + /** - * + * * * @since 1.3 **/ @@ -71,7 +71,7 @@ static function upgrade(Migration $migration) { global $DB; } - + static function uninstall() { global $DB; @@ -79,7 +79,7 @@ static function uninstall() { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => __CLASS__)); } - + // Remove dropdowns localization $dropdownTranslation = new DropdownTranslation(); $dropdownTranslation->deleteByCriteria(array("itemtype LIKE 'PluginSimcardSimcardVoltage'"), 1); @@ -87,7 +87,7 @@ static function uninstall() { $table = getTableForItemType(__CLASS__); $DB->query("DROP TABLE IF EXISTS `$table`"); } - + static function transfer($ID, $entity) { global $DB; @@ -120,4 +120,3 @@ static function transfer($ID, $entity) { } } -?> diff --git a/setup.php b/setup.php index 19235fc..8d96c0d 100644 --- a/setup.php +++ b/setup.php @@ -36,33 +36,33 @@ // Init the hooks of the plugins -Needed function plugin_init_simcard() { global $PLUGIN_HOOKS,$CFG_GLPI,$LANG; - + $PLUGIN_HOOKS['csrf_compliant']['simcard'] = true; - + $plugin = new Plugin(); if ($plugin->isInstalled('simcard') && $plugin->isActivated('simcard')) { - + //load changeprofile function (does not exist anymore in this version) - //$PLUGIN_HOOKS['change_profile']['simcard'] = array('PluginSimcardProfile','changeProfile'); - + //$PLUGIN_HOOKS['change_profile']['simcard'] = array('PluginSimcardProfile','changeProfile'); + $PLUGIN_HOOKS['assign_to_ticket']['simcard'] = true; $PLUGIN_HOOKS['plugin_datainjection_populate']['simcard'] = 'plugin_datainjection_populate_simcard'; $PLUGIN_HOOKS['item_purge']['simcard'] = array(); - + foreach (PluginSimcardSimcard_Item::getClasses() as $type) { $PLUGIN_HOOKS['item_purge']['simcard'][$type] = 'plugin_item_purge_simcard'; } - + $PLUGIN_HOOKS['item_update']['simcard']['ProfileRight'] = 'plugin_simcard_profileRightUpdate'; $PLUGIN_HOOKS['item_add']['simcard']['ProfileRight'] = 'plugin_simcard_profileRightUpdate'; - + Plugin::registerClass('PluginSimcardSimcard_Item', array('addtabon' => PluginSimcardSimcard_Item::getClasses())); Plugin::registerClass('PluginSimcardProfile', array('addtabon' => 'Profile')); - + // Params : plugin name - string type - number - class - table - form page Plugin::registerClass('PluginSimcardSimcard', array('linkgroup_types' => true, @@ -81,25 +81,24 @@ function plugin_init_simcard() { //if glpi is loaded if (Session::getLoginUserID()) { - + // Display a menu entry ? - if (PluginSimcardSimcard::canCreate() + if (PluginSimcardSimcard::canCreate() || PluginSimcardSimcard::canUpdate () || PluginSimcardSimcard::canDelete() - || PluginSimcardSimcard::canView()) - { + || PluginSimcardSimcard::canView()) { //menu entry - $PLUGIN_HOOKS['menu_toadd']['simcard'] = array('assets' => 'PluginSimcardSimcard'); + $PLUGIN_HOOKS['menu_toadd']['simcard'] = array('assets' => 'PluginSimcardSimcard'); //search link //add simcard to items details $PLUGIN_HOOKS['headings']['simcard'] = 'plugin_get_headings_simcard'; $PLUGIN_HOOKS['headings_action']['simcard'] = 'plugin_headings_actions_simcard'; $PLUGIN_HOOKS['headings_actionpdf']['simcard'] = 'plugin_headings_actionpdf_simcard'; } - + if (PluginSimcardSimcard::canCreate()) { //add link - + //use massiveaction in the plugin $PLUGIN_HOOKS['use_massive_action']['simcard'] = 1; } @@ -144,9 +143,9 @@ function plugin_simcard_check_config() { } /** - * + * * Migrate itemtype integer (0.72) to string (0.80) - * + * * @param array $types * @return string */ @@ -155,4 +154,3 @@ function plugin_datainjection_migratetypes_simcard($types) { return $types; } -?> From 45830ca9ce023f72eef2cfcf375b11bc454402fc Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 9 Feb 2017 09:07:53 +0100 Subject: [PATCH 04/10] Fix CS (empty if/else); fix phpdoc and headers in hook and setup --- front/simcard_item.form.php | 3 +-- hook.php | 28 +++++++++++++++++----- inc/simcard_item.class.php | 2 -- setup.php | 48 +++++++++++++++++++++++++++++-------- 4 files changed, 61 insertions(+), 20 deletions(-) diff --git a/front/simcard_item.form.php b/front/simcard_item.form.php index 5d2fa05..9b73912 100644 --- a/front/simcard_item.form.php +++ b/front/simcard_item.form.php @@ -35,8 +35,7 @@ $simcard_item = new PluginSimcardSimcard_Item(); if (isset($_POST["additem"])) { $simcard_item->can(-1, CREATE, $_POST); - if ($newID = $simcard_item->add($_POST)) { - } + $newID = $simcard_item->add($_POST); } else if (isset($_POST["delete_items"])) { if (isset($_POST['todelete'])) { foreach ($_POST['todelete'] as $id => $val) { diff --git a/hook.php b/hook.php index 6316e43..dfa8556 100644 --- a/hook.php +++ b/hook.php @@ -1,22 +1,28 @@ . + along with Simcard. If not, see . -------------------------------------------------------------------------- @package simcard @author the simcard plugin team @@ -26,7 +32,7 @@ @link https://github.com/pluginsglpi/simcard @link http://www.glpi-project.org/ @since 2009 - ---------------------------------------------------------------------- */ + */ /** * @@ -67,6 +73,11 @@ function plugin_simcard_currentVersion() { return $currentVersion; } +/** + * Plugin install process + * + * @return boolean + */ function plugin_simcard_install() { include_once (GLPI_ROOT."/plugins/simcard/inc/profile.class.php"); include_once (GLPI_ROOT."/plugins/simcard/inc/simcard.class.php"); @@ -103,6 +114,11 @@ function plugin_simcard_install() { return true; } +/** + * Plugin uninstall process + * + * @return boolean + */ function plugin_simcard_uninstall() { include_once (GLPI_ROOT."/plugins/simcard/inc/profile.class.php"); include_once (GLPI_ROOT."/plugins/simcard/inc/simcard.class.php"); diff --git a/inc/simcard_item.class.php b/inc/simcard_item.class.php index 664d50d..2107ce7 100644 --- a/inc/simcard_item.class.php +++ b/inc/simcard_item.class.php @@ -206,8 +206,6 @@ static function showForSimcard(PluginSimcardSimcard $simcard) { echo ""; if (isset($item->fields['serial'])) { echo $item->fields['serial']; - } else { - } echo ""; echo ""; diff --git a/setup.php b/setup.php index 8d96c0d..39dd0b9 100644 --- a/setup.php +++ b/setup.php @@ -1,22 +1,28 @@ . + along with Simcard. If not, see . -------------------------------------------------------------------------- @package simcard @author the simcard plugin team @@ -26,14 +32,19 @@ @link https://github.com/pluginsglpi/simcard @link http://www.glpi-project.org/ @since 2009 - ---------------------------------------------------------------------- */ + */ define ("PLUGIN_SIMCARD_VERSION", "1.4.2"); // Minimal GLPI version, inclusive define ("PLUGIN_SIMCARD_GLPI_MIN_VERSION", "0.85"); -// Init the hooks of the plugins -Needed +/** + * Init hooks of the plugin. + * REQUIRED + * + * @return void + */ function plugin_init_simcard() { global $PLUGIN_HOOKS,$CFG_GLPI,$LANG; @@ -111,7 +122,13 @@ function plugin_init_simcard() { } } -// Get the name and the version of the plugin - Needed + +/** + * Get the name and the version of the plugin + * REQUIRED + * + * @return array + */ function plugin_version_simcard() { global $LANG; @@ -128,7 +145,12 @@ function plugin_version_simcard() { 'minGlpiVersion' => PLUGIN_SIMCARD_GLPI_MIN_VERSION); } -// Optional : check prerequisites before install : may print errors or add to message after redirect +/** + * Check pre-requisites before install + * OPTIONNAL, but recommanded + * + * @return boolean + */ function plugin_simcard_check_prerequisites() { if (version_compare(GLPI_VERSION, PLUGIN_SIMCARD_GLPI_MIN_VERSION, 'lt')) { echo "This plugin requires GLPI >= " . PLUGIN_SIMCARD_GLPI_MIN_VERSION; @@ -137,7 +159,13 @@ function plugin_simcard_check_prerequisites() { return true; } -// Uninstall process for plugin : need to return true if succeeded : may display messages or add to message after redirect +/** + * Check configuration process + * + * @param boolean $verbose Whether to display message on failure. Defaults to false + * + * @return boolean + */ function plugin_simcard_check_config() { return true; } From f0c27c3f4b9a51936742da48eb6c571fa6868021 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 9 Feb 2017 09:13:58 +0100 Subject: [PATCH 05/10] Add transifex config --- .tx/config | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .tx/config diff --git a/.tx/config b/.tx/config new file mode 100644 index 0000000..7bf44a2 --- /dev/null +++ b/.tx/config @@ -0,0 +1,8 @@ +[main] +host = https://www.transifex.com + +[glpi-project-plugin-simcard.en_gbpo] +file_filter = locales/.po +source_file = locales/simcard.pot +source_lang = en + From 4c75cb6c100d85a3d5f1e2b754aa2364afd34329 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 9 Feb 2017 09:14:07 +0100 Subject: [PATCH 06/10] Update locales --- locales/cs_CZ.po | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ locales/en_US.po | 80 +++++++++++++++++++++++++++++++++++++++++++++++ locales/hu_HU.po | 80 +++++++++++++++++++++++++++++++++++++++++++++++ locales/it_IT.po | 80 +++++++++++++++++++++++++++++++++++++++++++++++ locales/pl_PL.po | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ locales/pt_BR.po | 80 +++++++++++++++++++++++++++++++++++++++++++++++ locales/ro_RO.po | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ locales/tr_TR.po | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 642 insertions(+) create mode 100644 locales/cs_CZ.po create mode 100644 locales/en_US.po create mode 100644 locales/hu_HU.po create mode 100644 locales/it_IT.po create mode 100644 locales/pl_PL.po create mode 100644 locales/pt_BR.po create mode 100644 locales/ro_RO.po create mode 100644 locales/tr_TR.po diff --git a/locales/cs_CZ.po b/locales/cs_CZ.po new file mode 100644 index 0000000..c42a217 --- /dev/null +++ b/locales/cs_CZ.po @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# David Stepan , 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2015-11-11 16:32+0000\n" +"Last-Translator: David Stepan \n" +"Language-Team: Czech (Czech Republic) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/cs_CZ/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: cs_CZ\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Rozměr" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Operátor" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Napětí" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "Typ SiM karty" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Telefonní číslo" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "Správa SIM karet" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Správce oprávnění" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "SIM karta" +msgstr[1] "SIM karty" +msgstr[2] "SIM karty" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "Pin1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "Pin2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "Puk1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "Puk2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "Nová SIM karta" diff --git a/locales/en_US.po b/locales/en_US.po new file mode 100644 index 0000000..deb1619 --- /dev/null +++ b/locales/en_US.po @@ -0,0 +1,80 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Shawn Long , 2016 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2016-11-16 23:58+0000\n" +"Last-Translator: Shawn Long \n" +"Language-Team: English (United States) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/en_US/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en_US\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Size" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Provider" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Voltage" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "Type of SIM Card" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Phone Number" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "Sim Cards Management" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Right Manager" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "SIM Card" +msgstr[1] "SIM Cards" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "Pin 1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "Pin 2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "Puk 1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "Puk 2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "New SIM Card" diff --git a/locales/hu_HU.po b/locales/hu_HU.po new file mode 100644 index 0000000..35cd577 --- /dev/null +++ b/locales/hu_HU.po @@ -0,0 +1,80 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Laszlo Czirbesz , 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2015-11-13 15:07+0000\n" +"Last-Translator: Laszlo Czirbesz \n" +"Language-Team: Hungarian (Hungary) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/hu_HU/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: hu_HU\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Méret" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Szolgáltató" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Feszültség" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "SIM kártya típusa" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Telefonszám" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "SIM kártyák kezelése" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Jogok kezelője" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "SIM kártya" +msgstr[1] "SIM kártyák" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "PIN 1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "PIN 2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "PUK 1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "PUK 2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "Új SIM kártya" diff --git a/locales/it_IT.po b/locales/it_IT.po new file mode 100644 index 0000000..06fb9a4 --- /dev/null +++ b/locales/it_IT.po @@ -0,0 +1,80 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Salvatore Russo , 2016 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2016-10-13 13:26+0000\n" +"Last-Translator: Salvatore Russo \n" +"Language-Team: Italian (Italy) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/it_IT/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: it_IT\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Dimensione" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Gestore" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Tensione di Alimentazione" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "Tipo di carta SIM" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Numero telefonico" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "Gestione delle carte Sim" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Gestore dei permessi" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "Carte SIM" +msgstr[1] "Carte SIM" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "Pin 1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "Pin 2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "Puk 1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "Puk 2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "Nuova carta SIM" diff --git a/locales/pl_PL.po b/locales/pl_PL.po new file mode 100644 index 0000000..d127648 --- /dev/null +++ b/locales/pl_PL.po @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Ryszard Jeziorski , 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2015-10-14 18:12+0000\n" +"Last-Translator: Ryszard Jeziorski \n" +"Language-Team: Polish (Poland) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/pl_PL/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pl_PL\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Rozmiar" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Dostawca" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Zasilanie" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "Typ karty SIM" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Numer telefonu" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "Zarządzanie kartami SIM" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Menedżer uprawnień" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "Karta SIM" +msgstr[1] "Karty SIM" +msgstr[2] "Karty SIM" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "PIN 1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "PIN 2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "PUK 1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "PUK 2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "Nowa karta SIM" diff --git a/locales/pt_BR.po b/locales/pt_BR.po new file mode 100644 index 0000000..d4b8bb2 --- /dev/null +++ b/locales/pt_BR.po @@ -0,0 +1,80 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Eduardo Spinola , 2016 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2016-07-27 11:35+0000\n" +"Last-Translator: Eduardo Spinola \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Tamanho" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Operadora" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Voltagem" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "Tipo de cartão SIM" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Número de telefone" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "Gerência de cartões SIM" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Gerente de Permissões" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "Cartão SIM" +msgstr[1] "Cartões SIM" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "Pin 1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "Pin 2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "Puk 1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "Puk 2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "Novo cartão SIM" diff --git a/locales/ro_RO.po b/locales/ro_RO.po new file mode 100644 index 0000000..7a11247 --- /dev/null +++ b/locales/ro_RO.po @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Doru DEACONU , 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2015-12-28 20:23+0000\n" +"Last-Translator: Doru DEACONU \n" +"Language-Team: Romanian (Romania) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/ro_RO/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ro_RO\n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Dimensiune" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Provider" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Voltaj" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "Tipul cardului SIM " + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Numar telefon" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "Management carduri SIM" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "Manager drepturi" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "Card SIM " +msgstr[1] "Carduri SIM " +msgstr[2] "Carduri SIM " + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "Pin 1" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "Pin 2" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "Puk 1" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "Puk 2" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "Card SIM nou" diff --git a/locales/tr_TR.po b/locales/tr_TR.po new file mode 100644 index 0000000..ea01a23 --- /dev/null +++ b/locales/tr_TR.po @@ -0,0 +1,79 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Kaya Zeren , 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Simcard\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-04-23 21:04+0200\n" +"PO-Revision-Date: 2015-10-25 16:18+0000\n" +"Last-Translator: Kaya Zeren \n" +"Language-Team: Turkish (Turkey) (http://www.transifex.com/teclib/glpi-project-plugin-simcard/language/tr_TR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: tr_TR\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: hook.php:163 inc/simcard.class.php:181 inc/simcard.class.php:427 +#: inc/simcardsize.class.php:41 +msgid "Size" +msgstr "Boyut" + +#: hook.php:164 inc/phoneoperator.class.php:40 inc/simcard.class.php:204 +#: inc/simcard.class.php:435 +msgid "Provider" +msgstr "Sağlayıcı" + +#: hook.php:165 hook.php:231 inc/simcard.class.php:197 +#: inc/simcard.class.php:409 inc/simcardvoltage.class.php:41 +msgid "Voltage" +msgstr "Gerilim" + +#: hook.php:166 inc/simcard.class.php:167 inc/simcardtype.class.php:41 +msgid "Type of SIM card" +msgstr "SIM kart tipi" + +#: hook.php:222 inc/simcard.class.php:243 inc/simcard.class.php:443 +msgid "Phone number" +msgstr "Telefon no" + +#: setup.php:130 +msgid "Sim cards management" +msgstr "SIM kart yönetimi" + +#: inc/profile.class.php:127 +msgid "Right manager" +msgstr "İzin yönetimi" + +#: inc/profile.class.php:263 inc/simcard.class.php:54 +msgid "SIM card" +msgid_plural "SIM cards" +msgstr[0] "SIM kartlar" + +#: inc/simcard.class.php:253 inc/simcard.class.php:367 +msgid "IMSI" +msgstr "IMSI" + +#: inc/simcard.class.php:273 inc/simcard.class.php:453 +msgid "Pin 1" +msgstr "1. Pin Kodu" + +#: inc/simcard.class.php:279 inc/simcard.class.php:469 +msgid "Pin 2" +msgstr "2. Pin Kodu" + +#: inc/simcard.class.php:285 inc/simcard.class.php:461 +msgid "Puk 1" +msgstr "1. Puk Kodu" + +#: inc/simcard.class.php:291 inc/simcard.class.php:477 +msgid "Puk 2" +msgstr "2. Puk Kodu" + +#: inc/simcard_item.class.php:217 +msgid "New SIM card" +msgstr "SIM kartı ekle" From ab36926dc80f1dbf6d3bf63bb06615d524748eda Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Mon, 20 Feb 2017 09:15:36 +0100 Subject: [PATCH 07/10] Fix phpcbf issues --- inc/profile.class.php | 6 +++--- inc/simcard.class.php | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/inc/profile.class.php b/inc/profile.class.php index bcc2721..dbfc2d1 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -137,11 +137,11 @@ static function upgrade(Migration $migration) { } $query = "DROP TABLE `glpi_plugin_simcard_profiles`"; $DB->query($query) or die($DB->error()); - break; + break; case '1.4': - case '1.4.1': - + case '1.4.1': + break; } } diff --git a/inc/simcard.class.php b/inc/simcard.class.php index 8762628..7de83c7 100644 --- a/inc/simcard.class.php +++ b/inc/simcard.class.php @@ -589,8 +589,8 @@ static function upgrade(Migration $migration) { switch (plugin_simcard_currentVersion()) { case '1.2': $sql = "ALTER TABLE `glpi_plugin_simcard_simcards` - ADD `plugin_simcard_simcardtypes_id` int(11) NOT NULL DEFAULT '0' AFTER `plugin_simcard_simcardvoltages_id`, - ADD `groups_id_tech` int(11) NOT NULL DEFAULT '0' AFTER `groups_id`"; + ADD `plugin_simcard_simcardtypes_id` int(11) NOT NULL DEFAULT '0' AFTER `plugin_simcard_simcardvoltages_id`, + ADD `groups_id_tech` int(11) NOT NULL DEFAULT '0' AFTER `groups_id`"; $DB->query($sql) or die($DB->error()); break; @@ -601,9 +601,9 @@ static function upgrade(Migration $migration) { // Migrate notepad data if (FieldExists('glpi_plugin_simcard_simcards', 'notepad')) { $query = "SELECT id, notepad - FROM `glpi_plugin_simcard_simcards` - WHERE notepad IS NOT NULL - AND notepad <> ''"; + FROM `glpi_plugin_simcard_simcards` + WHERE notepad IS NOT NULL + AND notepad <> ''"; foreach ($DB->request($query) as $data) { $iq = "INSERT INTO `glpi_notepads` (`itemtype`, `items_id`, `content`, `date`, `date_mod`) @@ -616,7 +616,7 @@ static function upgrade(Migration $migration) { $DB->query($sql) or die($DB->error()); } - break; + break; } } From c6d2c19f26adabab9569704a556c22ef4a3beda2 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Pineau Date: Mon, 6 Mar 2017 14:01:12 +0100 Subject: [PATCH 08/10] drop dead code; fix #58 --- inc/simcard.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/inc/simcard.class.php b/inc/simcard.class.php index 7de83c7..c5f87aa 100644 --- a/inc/simcard.class.php +++ b/inc/simcard.class.php @@ -281,7 +281,6 @@ function showForm($ID, $options=array()) { } $this->showFormButtons($options); - //$this->addDivForTabs(); return true; } From 0f26994ccb5e1526eefbbfd7c05dab685465e221 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Pineau Date: Wed, 8 Mar 2017 23:09:01 +0100 Subject: [PATCH 09/10] cleanup useless globals, rework on search options --- hook.php | 8 +----- inc/phoneoperator.class.php | 1 - inc/profile.class.php | 3 -- inc/simcard.class.php | 54 +++++++++++++++--------------------- inc/simcard_item.class.php | 8 ++---- inc/simcardsize.class.php | 1 - inc/simcardtype.class.php | 1 - inc/simcardvoltage.class.php | 3 -- setup.php | 4 +-- 9 files changed, 26 insertions(+), 57 deletions(-) diff --git a/hook.php b/hook.php index dfa8556..2bbd062 100644 --- a/hook.php +++ b/hook.php @@ -39,7 +39,7 @@ * Determine if the plugin should be installed or upgraded * * Returns 0 if the plugin is not yet installed - * Returns 1 if the plugin is already installed + * Returns the plugin's version if installed * * @since 1.3 * @@ -171,8 +171,6 @@ function plugin_simcard_getDatabaseRelations() { // Define Dropdown tables to be manage in GLPI : function plugin_simcard_getDropdown() { - global $LANG; - $plugin = new Plugin(); if ($plugin->isActivated("simcard")) { return array('PluginSimcardSimcardSize' => __('Size', 'simcard'), @@ -186,8 +184,6 @@ function plugin_simcard_getDropdown() { } function plugin_simcard_AssignToTicket($types) { - global $LANG; - if (Session::haveRight(PluginSimcardProfile::RIGHT_SIMCARD_SIMCARD, PluginSimcardProfile::SIMCARD_ASSOCIATE_TICKET)) { $types['PluginSimcardSimcard'] = _sn('SIM card', 'SIM cards', 2, 'simcard'); } @@ -211,8 +207,6 @@ function plugin_simcard_forceGroupBy($type) { function plugin_simcard_getAddSearchOptions($itemtype) { - global $LANG; - $sopt = array(); $reservedTypeIndex = PluginSimcardConfig::RESERVED_TYPE_RANGE_MIN; diff --git a/inc/phoneoperator.class.php b/inc/phoneoperator.class.php index f3665ea..f2ff874 100644 --- a/inc/phoneoperator.class.php +++ b/inc/phoneoperator.class.php @@ -36,7 +36,6 @@ class PluginSimcardPhoneOperator extends CommonDropdown { static function getTypeName($nb=0) { - global $LANG; return __('Provider', 'simcard'); } diff --git a/inc/profile.class.php b/inc/profile.class.php index dbfc2d1..ec2bfa2 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -65,8 +65,6 @@ static function createFirstAccess($ID) { //profiles modification function showForm($ID, $options = array()) { - global $LANG; - if (!Profile::canView()) { return false; } @@ -178,7 +176,6 @@ static function uninstall() { } function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { - global $LANG; if ($item->getType()=='Profile') { return _sn('SIM card', 'SIM cards', 2, 'simcard'); } diff --git a/inc/simcard.class.php b/inc/simcard.class.php index c5f87aa..9b01341 100644 --- a/inc/simcard.class.php +++ b/inc/simcard.class.php @@ -51,7 +51,6 @@ class PluginSimcardSimcard extends CommonDBTM { * @param $nb integer number of item in the type (default 0) **/ static function getTypeName($nb=0) { - global $LANG; return _n('SIM card', 'SIM cards', $nb, 'simcard'); } @@ -68,7 +67,6 @@ function getRights($interface='central') { } function defineTabs($options=array()) { - global $LANG; $ong = array(); $this->addDefaultFormTab($ong); if ($this->fields['id'] > 0) { @@ -110,8 +108,6 @@ function defineTabs($options=array()) { *@return Nothing (display) **/ function showForm($ID, $options=array()) { - global $CFG_GLPI, $DB, $LANG; - if (!$this->canView()) { return false; } @@ -297,8 +293,6 @@ function prepareInputForAdd($input) { } function post_addItem() { - global $DB, $CFG_GLPI; - // Manage add from template if (isset($this->input["_oldID"])) { Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']); @@ -317,12 +311,10 @@ function post_addItem() { } function getSearchOptions() { - global $CFG_GLPI, $LANG; - $tab = array(); $tab['common'] = __s('SIM card', 'simcard'); - $tab[1]['table'] = $this->getTable(); + $tab[1]['table'] = static::getTable(); $tab[1]['field'] = 'name'; $tab[1]['name'] = __('Name'); $tab[1]['datatype'] = 'itemlink'; @@ -332,13 +324,13 @@ function getSearchOptions() { $tab[1]['checktype'] = 'text'; $tab[1]['displaytype'] = 'text'; - $tab[2]['table'] = $this->getTable(); + $tab[2]['table'] = static::getTable(); $tab[2]['field'] = 'id'; $tab[2]['name'] = __('ID'); $tab[2]['massiveaction'] = false; // implicit field is id $tab[2]['injectable'] = false; - $tab[4]['table'] = 'glpi_plugin_simcard_simcardtypes'; + $tab[4]['table'] = PluginSimcardSimcardType::getTable(); $tab[4]['field'] = 'name'; $tab[4]['name'] = __('Type'); $tab[4]['datatype'] = 'dropdown'; @@ -347,7 +339,7 @@ function getSearchOptions() { $tab[4]['displaytype'] = 'dropdown'; $tab[4]['injectable'] = true; - $tab[5]['table'] = $this->getTable(); + $tab[5]['table'] = static::getTable(); $tab[5]['field'] = 'serial'; $tab[5]['name'] = __('IMSI', 'simcard'); $tab[5]['datatype'] = 'string'; @@ -355,7 +347,7 @@ function getSearchOptions() { $tab[5]['displaytype'] = 'text'; $tab[5]['injectable'] = true; - $tab[6]['table'] = $this->getTable(); + $tab[6]['table'] = static::getTable(); $tab[6]['field'] = 'otherserial'; $tab[6]['name'] = __('Inventory number'); $tab[6]['datatype'] = 'string'; @@ -363,7 +355,7 @@ function getSearchOptions() { $tab[6]['displaytype'] = 'text'; $tab[6]['injectable'] = true; - $tab[16]['table'] = $this->getTable(); + $tab[16]['table'] = static::getTable(); $tab[16]['field'] = 'comment'; $tab[16]['name'] = __('Comments'); $tab[16]['datatype'] = 'text'; @@ -382,7 +374,7 @@ function getSearchOptions() { $tab[91]['injectable'] = false; $tab[93]['injectable'] = false; - $tab[19]['table'] = $this->getTable(); + $tab[19]['table'] = static::getTable(); $tab[19]['field'] = 'date_mod'; $tab[19]['name'] = __('Last update'); $tab[19]['datatype'] = 'datetime'; @@ -390,7 +382,7 @@ function getSearchOptions() { $tab[19]['injectable'] = false; // TODO : This index has not any similar in GLPI, should find an other index - $tab[23]['table'] = 'glpi_plugin_simcard_simcardvoltages'; + $tab[23]['table'] = PluginSimcardSimcardVoltage::getTable(); $tab[23]['field'] = 'name'; $tab[23]['name'] = __('Voltage', 'simcard'); $tab[23]['datatype'] = 'dropdown'; @@ -398,7 +390,7 @@ function getSearchOptions() { $tab[23]['displaytype'] = 'dropdown'; $tab[23]['injectable'] = true; - $tab[24]['table'] = 'glpi_users'; + $tab[24]['table'] = User::getTable(); $tab[24]['field'] = 'name'; $tab[24]['linkfield'] = 'users_id_tech'; $tab[24]['name'] = __('Technician in charge of the hardware'); @@ -408,7 +400,7 @@ function getSearchOptions() { $tab[24]['displaytype'] = 'dropdown'; $tab[24]['injectable'] = true; - $tab[25]['table'] = 'glpi_plugin_simcard_simcardsizes'; + $tab[25]['table'] = PluginSimcardSimcardSize::getTable(); $tab[25]['field'] = 'name'; $tab[25]['name'] = __('Size', 'simcard'); $tab[25]['datatype'] = 'dropdown'; @@ -416,7 +408,7 @@ function getSearchOptions() { $tab[25]['displaytype'] = 'dropdown'; $tab[25]['injectable'] = true; - $tab[26]['table'] = 'glpi_plugin_simcard_phoneoperators'; + $tab[26]['table'] = PluginSimcardPhoneOperator::getTable(); $tab[26]['field'] = 'name'; $tab[26]['name'] = __('Provider', 'simcard'); $tab[26]['datatype'] = 'dropdown'; @@ -424,7 +416,7 @@ function getSearchOptions() { $tab[26]['displaytype'] = 'dropdown'; $tab[26]['injectable'] = true; - $tab[27]['table'] = $this->getTable(); + $tab[27]['table'] = static::getTable(); $tab[27]['field'] = 'phonenumber'; $tab[27]['name'] = __('Phone number', 'simcard'); $tab[27]['datatype'] = 'string'; @@ -433,7 +425,7 @@ function getSearchOptions() { $tab[27]['injectable'] = true; if (PluginSimcardSimcard::canUpdate()) { - $tab[28]['table'] = $this->getTable(); + $tab[28]['table'] = static::getTable(); $tab[28]['field'] = 'pin'; $tab[28]['name'] = __('Pin 1', 'simcard'); $tab[28]['datatype'] = 'string'; @@ -441,7 +433,7 @@ function getSearchOptions() { $tab[28]['displaytype'] = 'text'; $tab[28]['injectable'] = true; - $tab[29]['table'] = $this->getTable(); + $tab[29]['table'] = static::getTable(); $tab[29]['field'] = 'puk'; $tab[29]['name'] = __('Puk 1', 'simcard'); $tab[29]['datatype'] = 'string'; @@ -449,7 +441,7 @@ function getSearchOptions() { $tab[29]['displaytype'] = 'text'; $tab[29]['injectable'] = true; - $tab[30]['table'] = $this->getTable(); + $tab[30]['table'] = static::getTable(); $tab[30]['field'] = 'pin2'; $tab[30]['name'] = __('Pin 2', 'simcard'); $tab[30]['datatype'] = 'string'; @@ -457,7 +449,7 @@ function getSearchOptions() { $tab[30]['displaytype'] = 'text'; $tab[30]['injectable'] = true; - $tab[32]['table'] = $this->getTable(); + $tab[32]['table'] = static::getTable(); $tab[32]['field'] = 'puk2'; $tab[32]['name'] = __('Puk 2', 'simcard'); $tab[32]['datatype'] = 'string'; @@ -466,7 +458,7 @@ function getSearchOptions() { $tab[32]['injectable'] = true; } - $tab[31]['table'] = 'glpi_states'; + $tab[31]['table'] = State::getTable(); $tab[31]['field'] = 'name'; $tab[31]['name'] = __('Status'); $tab[31]['datatype'] = 'dropdown'; @@ -474,7 +466,7 @@ function getSearchOptions() { $tab[31]['displaytype'] = 'dropdown'; $tab[31]['injectable'] = true; - $tab[71]['table'] = 'glpi_groups'; + $tab[71]['table'] = Group::getTable(); $tab[71]['field'] = 'completename'; $tab[71]['name'] = __('Group'); $tab[71]['datatype'] = 'dropdown'; @@ -482,7 +474,7 @@ function getSearchOptions() { $tab[71]['displaytype'] = 'dropdown'; $tab[71]['injectable'] = true; - $tab[49]['table'] = 'glpi_groups'; + $tab[49]['table'] = Group::getTable(); $tab[49]['field'] = 'name'; $tab[49]['linkfield'] = 'groups_id_tech'; $tab[49]['condition'] = '`is_assign`'; @@ -492,7 +484,7 @@ function getSearchOptions() { $tab[49]['displaytype'] = 'dropdown'; $tab[49]['injectable'] = true; - $tab[70]['table'] = 'glpi_users'; + $tab[70]['table'] = User::getTable(); $tab[70]['field'] = 'name'; $tab[70]['name'] = __('User'); $tab[70]['datatype'] = 'dropdown'; @@ -501,12 +493,12 @@ function getSearchOptions() { $tab[70]['displaytype'] = 'dropdown'; $tab[70]['injectable'] = true; - $tab[80]['table'] = 'glpi_entities'; + $tab[80]['table'] = Entity::getTable(); $tab[80]['field'] = 'completename'; $tab[80]['name'] = __('Entity'); $tab[80]['injectable'] = false; - $tab[90]['table'] = $this->getTable(); + $tab[90]['table'] = static::getTable(); $tab[90]['field'] = 'notepad'; $tab[90]['name'] = __('Notes'); $tab[90]['massiveaction'] = false; @@ -644,8 +636,6 @@ static function uninstall() { } function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { - global $LANG; - if (in_array(get_class($item), PluginSimcardSimcard_Item::getClasses()) || get_class($item) == 'Profile') { return array(1 => _sn('SIM card', 'SIM cards', 2, 'simcard')); diff --git a/inc/simcard_item.class.php b/inc/simcard_item.class.php index 2107ce7..95a8583 100644 --- a/inc/simcard_item.class.php +++ b/inc/simcard_item.class.php @@ -57,7 +57,6 @@ class PluginSimcardSimcard_Item extends CommonDBRelation{ * @param $nb integer number of item in the type (default 0) **/ static function getTypeName($nb=0) { - global $LANG; return __s('Direct Connections'); } @@ -71,7 +70,6 @@ static function getTypeName($nb=0) { * @return boolean **/ function can($ID, $right, array &$input=NULL) { - if ($ID<0) { // Ajout if (!($item = new $input['itemtype'])) { @@ -155,8 +153,6 @@ static function install(Migration $migration) { * @since 1.3 **/ static function upgrade(Migration $migration) { - global $DB; - } static function uninstall() { @@ -166,7 +162,7 @@ static function uninstall() { } static function showForSimcard(PluginSimcardSimcard $simcard) { - global $DB, $LANG; + global $DB; if (!$simcard->canView()) { return false; @@ -240,7 +236,7 @@ static function showForSimcard(PluginSimcardSimcard $simcard) { } static function showForItem(CommonDBTM $item) { - global $DB, $LANG; + global $DB; if (!$item->canView()) { return false; diff --git a/inc/simcardsize.class.php b/inc/simcardsize.class.php index 87b7bed..9f0fc30 100644 --- a/inc/simcardsize.class.php +++ b/inc/simcardsize.class.php @@ -37,7 +37,6 @@ class PluginSimcardSimcardSize extends CommonDropdown { static function getTypeName($nb=0) { - global $LANG; return __s('Size', 'simcard'); } diff --git a/inc/simcardtype.class.php b/inc/simcardtype.class.php index adb3ade..3633d55 100644 --- a/inc/simcardtype.class.php +++ b/inc/simcardtype.class.php @@ -37,7 +37,6 @@ class PluginSimcardSimcardType extends CommonDropdown { static function getTypeName($nb = 0) { - global $LANG; return __s('Type of SIM card', 'simcard'); } diff --git a/inc/simcardvoltage.class.php b/inc/simcardvoltage.class.php index 3dd95ad..3be18c1 100644 --- a/inc/simcardvoltage.class.php +++ b/inc/simcardvoltage.class.php @@ -37,7 +37,6 @@ class PluginSimcardSimcardVoltage extends CommonDropdown { static function getTypeName($nb=0) { - global $LANG; return __s('Voltage', 'simcard'); } @@ -68,8 +67,6 @@ static function install(Migration $migration) { * @since 1.3 **/ static function upgrade(Migration $migration) { - global $DB; - } static function uninstall() { diff --git a/setup.php b/setup.php index 39dd0b9..cbc06c0 100644 --- a/setup.php +++ b/setup.php @@ -46,7 +46,7 @@ * @return void */ function plugin_init_simcard() { - global $PLUGIN_HOOKS,$CFG_GLPI,$LANG; + global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['simcard'] = true; @@ -130,8 +130,6 @@ function plugin_init_simcard() { * @return array */ function plugin_version_simcard() { - global $LANG; - $author = "El Sendero"; $author.= ", Walid Nouh"; $author.= ", Thierry Bugier Pineau"; From e34103957d77510b648974c823ae8a0aca2ac953 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Pineau Date: Thu, 9 Mar 2017 09:01:10 +0100 Subject: [PATCH 10/10] prefer call on object instead of class --- inc/simcard.class.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/inc/simcard.class.php b/inc/simcard.class.php index 9b01341..d3b3152 100644 --- a/inc/simcard.class.php +++ b/inc/simcard.class.php @@ -314,7 +314,7 @@ function getSearchOptions() { $tab = array(); $tab['common'] = __s('SIM card', 'simcard'); - $tab[1]['table'] = static::getTable(); + $tab[1]['table'] = $this::getTable(); $tab[1]['field'] = 'name'; $tab[1]['name'] = __('Name'); $tab[1]['datatype'] = 'itemlink'; @@ -324,7 +324,7 @@ function getSearchOptions() { $tab[1]['checktype'] = 'text'; $tab[1]['displaytype'] = 'text'; - $tab[2]['table'] = static::getTable(); + $tab[2]['table'] = $this::getTable(); $tab[2]['field'] = 'id'; $tab[2]['name'] = __('ID'); $tab[2]['massiveaction'] = false; // implicit field is id @@ -339,7 +339,7 @@ function getSearchOptions() { $tab[4]['displaytype'] = 'dropdown'; $tab[4]['injectable'] = true; - $tab[5]['table'] = static::getTable(); + $tab[5]['table'] = $this::getTable(); $tab[5]['field'] = 'serial'; $tab[5]['name'] = __('IMSI', 'simcard'); $tab[5]['datatype'] = 'string'; @@ -347,7 +347,7 @@ function getSearchOptions() { $tab[5]['displaytype'] = 'text'; $tab[5]['injectable'] = true; - $tab[6]['table'] = static::getTable(); + $tab[6]['table'] = $this::getTable(); $tab[6]['field'] = 'otherserial'; $tab[6]['name'] = __('Inventory number'); $tab[6]['datatype'] = 'string'; @@ -355,7 +355,7 @@ function getSearchOptions() { $tab[6]['displaytype'] = 'text'; $tab[6]['injectable'] = true; - $tab[16]['table'] = static::getTable(); + $tab[16]['table'] = $this::getTable(); $tab[16]['field'] = 'comment'; $tab[16]['name'] = __('Comments'); $tab[16]['datatype'] = 'text'; @@ -374,7 +374,7 @@ function getSearchOptions() { $tab[91]['injectable'] = false; $tab[93]['injectable'] = false; - $tab[19]['table'] = static::getTable(); + $tab[19]['table'] = $this::getTable(); $tab[19]['field'] = 'date_mod'; $tab[19]['name'] = __('Last update'); $tab[19]['datatype'] = 'datetime'; @@ -416,7 +416,7 @@ function getSearchOptions() { $tab[26]['displaytype'] = 'dropdown'; $tab[26]['injectable'] = true; - $tab[27]['table'] = static::getTable(); + $tab[27]['table'] = $this::getTable(); $tab[27]['field'] = 'phonenumber'; $tab[27]['name'] = __('Phone number', 'simcard'); $tab[27]['datatype'] = 'string'; @@ -425,7 +425,7 @@ function getSearchOptions() { $tab[27]['injectable'] = true; if (PluginSimcardSimcard::canUpdate()) { - $tab[28]['table'] = static::getTable(); + $tab[28]['table'] = $this::getTable(); $tab[28]['field'] = 'pin'; $tab[28]['name'] = __('Pin 1', 'simcard'); $tab[28]['datatype'] = 'string'; @@ -433,7 +433,7 @@ function getSearchOptions() { $tab[28]['displaytype'] = 'text'; $tab[28]['injectable'] = true; - $tab[29]['table'] = static::getTable(); + $tab[29]['table'] = $this::getTable(); $tab[29]['field'] = 'puk'; $tab[29]['name'] = __('Puk 1', 'simcard'); $tab[29]['datatype'] = 'string'; @@ -441,7 +441,7 @@ function getSearchOptions() { $tab[29]['displaytype'] = 'text'; $tab[29]['injectable'] = true; - $tab[30]['table'] = static::getTable(); + $tab[30]['table'] = $this::getTable(); $tab[30]['field'] = 'pin2'; $tab[30]['name'] = __('Pin 2', 'simcard'); $tab[30]['datatype'] = 'string'; @@ -449,7 +449,7 @@ function getSearchOptions() { $tab[30]['displaytype'] = 'text'; $tab[30]['injectable'] = true; - $tab[32]['table'] = static::getTable(); + $tab[32]['table'] = $this::getTable(); $tab[32]['field'] = 'puk2'; $tab[32]['name'] = __('Puk 2', 'simcard'); $tab[32]['datatype'] = 'string'; @@ -498,7 +498,7 @@ function getSearchOptions() { $tab[80]['name'] = __('Entity'); $tab[80]['injectable'] = false; - $tab[90]['table'] = static::getTable(); + $tab[90]['table'] = $this::getTable(); $tab[90]['field'] = 'notepad'; $tab[90]['name'] = __('Notes'); $tab[90]['massiveaction'] = false;