├── consumables.png ├── locales ├── cs_CZ.mo ├── de_DE.mo ├── el_GR.mo ├── en_GB.mo ├── es_ES.mo ├── fi_FI.mo ├── fr_FR.mo ├── pl_PL.mo ├── pt_BR.mo ├── pt_PT.mo ├── ru_RU.mo ├── es_419.mo ├── glpi.pot ├── el_GR.po ├── en_GB.po ├── fi_FI.po ├── es_419.po ├── es_ES.po ├── pt_PT.po ├── pt_BR.po ├── de_DE.po ├── fr_FR.po ├── es_EC.po ├── pl_PL.po ├── cs_CZ.po └── ru_RU.po ├── public ├── pics │ └── large-loading.gif ├── css │ └── consumables.css └── js │ └── consumables.js ├── wiki ├── Menu plugin consumables.png └── Wizard plugin consumables.png ├── install ├── sql │ ├── update-2.0.1.sql │ ├── update-2.1.2.sql │ ├── update-1.2.2.sql │ ├── empty-1.0.0.sql │ ├── empty-2.1.2.sql │ ├── empty-1.2.2.sql │ ├── empty-1.4.0.sql │ ├── empty-1.6.0.sql │ ├── empty-2.0.0.sql │ └── empty-2.0.1.sql └── install.php ├── tools ├── extract_template.sh ├── update_mo.pl └── update_po.pl ├── ISSUE_TEMPLATE.md ├── README.md ├── .github └── workflows │ ├── updatepot.yml │ ├── generatemo.yml │ └── release.yml ├── index.php ├── ajax ├── index.php ├── request.php └── dropdownAllItems.php ├── front ├── index.php ├── option.form.php ├── wizard.php ├── validation.php └── wizard.form.php ├── src ├── Menu.php ├── Servicecatalog.php ├── Field.php ├── Wizard.php ├── Helpdesk │ └── Tile │ │ └── ConsumablesPageTile.php ├── NotificationTargetRequest.php └── Profile.php ├── consumables.xml ├── setup.php └── hook.php /consumables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/consumables.png -------------------------------------------------------------------------------- /locales/cs_CZ.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/cs_CZ.mo -------------------------------------------------------------------------------- /locales/de_DE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/de_DE.mo -------------------------------------------------------------------------------- /locales/el_GR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/el_GR.mo -------------------------------------------------------------------------------- /locales/en_GB.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/en_GB.mo -------------------------------------------------------------------------------- /locales/es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/es_ES.mo -------------------------------------------------------------------------------- /locales/fi_FI.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/fi_FI.mo -------------------------------------------------------------------------------- /locales/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/fr_FR.mo -------------------------------------------------------------------------------- /locales/pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/pl_PL.mo -------------------------------------------------------------------------------- /locales/pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/pt_BR.mo -------------------------------------------------------------------------------- /locales/pt_PT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/pt_PT.mo -------------------------------------------------------------------------------- /locales/ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/ru_RU.mo -------------------------------------------------------------------------------- /locales/es_419.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/locales/es_419.mo -------------------------------------------------------------------------------- /public/pics/large-loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/public/pics/large-loading.gif -------------------------------------------------------------------------------- /wiki/Menu plugin consumables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/wiki/Menu plugin consumables.png -------------------------------------------------------------------------------- /wiki/Wizard plugin consumables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/consumables/master/wiki/Wizard plugin consumables.png -------------------------------------------------------------------------------- /install/sql/update-2.0.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_consumables_requests` CHANGE `consumables_id` `consumableitems_id` int unsigned NOT NULL DEFAULT '0'; 2 | ALTER TABLE `glpi_plugin_consumables_fields` CHANGE `consumables_id` `consumableitems_id` int unsigned NOT NULL DEFAULT '0'; 3 | ALTER TABLE `glpi_plugin_consumables_options` CHANGE `consumables_id` `consumableitems_id` int unsigned NOT NULL DEFAULT '0'; -------------------------------------------------------------------------------- /install/sql/update-2.1.2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `glpi_plugin_consumables_helpdesks_tiles_consumablespagetiles` ( 2 | `id` int unsigned NOT NULL AUTO_INCREMENT, 3 | `title` varchar(255) DEFAULT NULL, 4 | `description` text DEFAULT null, 5 | `illustration` varchar(255) DEFAULT NULL, 6 | `url` text DEFAULT NULL, 7 | PRIMARY KEY (`id`) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 9 | -------------------------------------------------------------------------------- /tools/extract_template.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Only strings with domain specified are extracted (use Xt args of keyword param to set number of args needed) 4 | 5 | xgettext *.php */*.php */*/*.php */*/*/*.php --copyright-holder='Consumables Development Team' --package-name='GLPI - Consumables plugin' -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po \ 6 | --keyword=_n:1,2,4t --keyword=__s:1,2t --keyword=__:1,2t --keyword=_e:1,2t --keyword=_x:1c,2,3t \ 7 | --keyword=_ex:1c,2,3t --keyword=_nx:1c,2,3,5t --keyword=_sx:1c,2,3t 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Dear GLPi user. 2 | 3 | BEFORE SUBMITTING YOUR ISSUE, please make sure to read and follow these steps : 4 | 5 | * Verify that your question has not already been asked 6 | * Please use the below template. 7 | * Delete this text before submiting your issue. 8 | 9 | The Plugin team. 10 | 11 | ------------ 12 | * Version of the plugin : 13 | 14 | 15 | * Version of your GLPI : 16 | 17 | 18 | * Steps to reproduce (which actions have you made) : 19 | 20 | 21 | * Expected result : 22 | 23 | 24 | * Actual result : 25 | 26 | 27 | * URL of the page : 28 | 29 | 30 | * Screenshot of the problem (if pertinent) : 31 | 32 | -------------------------------------------------------------------------------- /install/sql/update-1.2.2.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_options' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 5 | CREATE TABLE `glpi_plugin_consumables_options` ( 6 | `id` int(11) NOT NULL AUTO_INCREMENT, 7 | `consumables_id` int(11) NOT NULL DEFAULT '0', 8 | `groups` longtext collate utf8_unicode_ci DEFAULT NULL, 9 | `max_cart` smallint(6) NOT NULL DEFAULT '0', 10 | PRIMARY KEY (`id`) 11 | ) ENGINE = MyISAM DEFAULT CHARSET = utf8 collate = utf8_unicode_ci AUTO_INCREMENT = 1; -------------------------------------------------------------------------------- /tools/update_mo.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | #!/usr/bin/perl -w 3 | 4 | if (@ARGV!=0){ 5 | print "USAGE update_mo.pl\n\n"; 6 | 7 | exit(); 8 | } 9 | 10 | 11 | opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; 12 | foreach (readdir(DIRHANDLE)){ 13 | if ($_ ne '..' && $_ ne '.'){ 14 | 15 | if(!(-l "$dir/$_")){ 16 | if (index($_,".po",0)==length($_)-3) { 17 | $lang=$_; 18 | $lang=~s/\.po//; 19 | 20 | `msgfmt locales/$_ -o locales/$lang.mo`; 21 | } 22 | } 23 | 24 | } 25 | } 26 | closedir DIRHANDLE; 27 | 28 | # 29 | # 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # consumables 2 | Plugin consumables pour GLPI 3 | 4 | Ce plugin est sur Transifex - Aidez-nous à le traduire : 5 | https://www.transifex.com/infotelGLPI/GLPI_consumables/ 6 | 7 | This plugin is on Transifex - Help us to translate : 8 | https://www.transifex.com/infotelGLPI/GLPI_consumables/ 9 | 10 | ### Français 11 | 12 | Ce plugin vous permet de gérer les demandes de consommables pour les utilisateur finaux. 13 | * Système de validation de demande de consommables 14 | * Notifications associées 15 | * Wizard utilisateur basé sur le stock disponible 16 | 17 | ![](https://github.com/InfotelGLPI/consumables/blob/master/wiki/Menu%20plugin%20consumables.png) 18 | 19 | 20 | ![](https://github.com/InfotelGLPI/consumables/blob/master/wiki/Wizard%20plugin%20consumables.png) 21 | -------------------------------------------------------------------------------- /.github/workflows/updatepot.yml: -------------------------------------------------------------------------------- 1 | name: Update POT 2 | on: 3 | push: 4 | branches: [ master ] 5 | paths-ignore: 6 | - 'locales/**' 7 | 8 | env: 9 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 10 | jobs: 11 | run: 12 | 13 | name: Update POT 14 | 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout repo 18 | uses: actions/checkout@v4 19 | 20 | - name: install xgettext 21 | 22 | run: sudo apt-get install gettext; 23 | - name: Update POT 24 | run: sh tools/extract_template.sh; 25 | 26 | - name: Commit changes 27 | uses: EndBug/add-and-commit@v9 28 | with: 29 | message: "Update POT" 30 | 31 | - name: Push changes 32 | uses: actions-go/push@master 33 | with: 34 | commit-message: '' 35 | 36 | -------------------------------------------------------------------------------- /tools/update_po.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | #!/usr/bin/perl -w 3 | 4 | if (@ARGV!=2){ 5 | print "USAGE update_po.pl transifex_login transifex_password\n\n"; 6 | 7 | exit(); 8 | } 9 | $user = $ARGV[0]; 10 | $password = $ARGV[1]; 11 | 12 | opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; 13 | foreach (readdir(DIRHANDLE)){ 14 | if ($_ ne '..' && $_ ne '.'){ 15 | 16 | if(!(-l "$dir/$_")){ 17 | if (index($_,".po",0)==length($_)-3) { 18 | $lang=$_; 19 | $lang=~s/\.po//; 20 | 21 | `wget --user=$user --password=$password --output-document=locales/$_ http://www.transifex.com/api/2/project/GLPI_consumables/resource/glpipot/translation/$lang/?file=$_`; 22 | } 23 | } 24 | 25 | } 26 | } 27 | closedir DIRHANDLE; 28 | 29 | # 30 | # 31 | -------------------------------------------------------------------------------- /.github/workflows/generatemo.yml: -------------------------------------------------------------------------------- 1 | name: Generate MO 2 | on: 3 | push: 4 | branches: [ master ] 5 | paths: 6 | - '**.po' 7 | env: 8 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 9 | jobs: 10 | run: 11 | 12 | name: Generate mo 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout repo 16 | uses: actions/checkout@v4 17 | 18 | - name: Setup Perl environment 19 | # You may pin to the exact commit or the version. 20 | # uses: shogo82148/actions-setup-perl@8d2e3d59a9516b785ed32169d48a4888eaa9b514 21 | uses: shogo82148/actions-setup-perl@v1 22 | - name: msgfmt 23 | # You may pin to the exact commit or the version. 24 | # uses: whtsky/msgfmt-action@6b2181f051b002182d01a1e1f1aff216230c5a4d 25 | uses: whtsky/msgfmt-action@20190305 26 | - name: Generate mo 27 | run: perl tools/update_mo.pl; 28 | 29 | - name: Commit changes 30 | uses: EndBug/add-and-commit@v9 31 | with: 32 | 33 | message: "Generate mo" 34 | - name: Push changes 35 | 36 | uses: actions-go/push@master 37 | with: 38 | commit-message: '' 39 | 40 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /ajax/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /front/index.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | -------------------------------------------------------------------------------- /front/option.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Consumables\Option; 31 | 32 | Session::checkLoginUser(); 33 | 34 | $option = new Option(); 35 | 36 | if (isset($_POST["add_groups"]) 37 | || isset($_POST["delete_groups"]) 38 | || isset($_POST["update"])) { 39 | $option->update($_POST); 40 | Html::back(); 41 | } 42 | -------------------------------------------------------------------------------- /public/css/consumables.css: -------------------------------------------------------------------------------- 1 | .consumables_wizard_row { 2 | width: 50%; 3 | } 4 | 5 | .consumables_wizard_rank { 6 | margin: 0 auto; 7 | padding: 5px; 8 | border: 1px solid #ccc; 9 | z-index: 1; 10 | text-align: left; 11 | font-size: 14px; 12 | /*width: 100%;*/ 13 | background-color: #ffffff; 14 | 15 | /*-moz-border-radius: 5px;*/ 16 | /*-webkit-border-radius: 5px;*/ 17 | /*border-radius: 5px;*/ 18 | 19 | /*-moz-box-shadow: 0px 2px 5px #666;*/ 20 | /*-webkit-box-shadow: 0px 2px 5px #666;*/ 21 | /*box-shadow: 0px 2px 5px #666;*/ 22 | } 23 | 24 | .consumables_wizard_title { 25 | font-size: 18px; 26 | text-align: center; 27 | margin-bottom: 5px; 28 | color: black; 29 | } 30 | 31 | .consumables_wizard_img { 32 | vertical-align: middle; 33 | width: 64px; 34 | height: 64px; 35 | } 36 | 37 | .consumables_menu_img { 38 | width: 64px; 39 | height: 64px; 40 | /*padding: 10px;*/ 41 | } 42 | 43 | .consumables_wizard_button { 44 | height: 35px; 45 | border-top: 2px outset black; 46 | } 47 | 48 | .consumable_previous_button { 49 | float: left; 50 | } 51 | 52 | .consumable_next_button { 53 | float: right; 54 | } 55 | 56 | .consumables_wizard { 57 | margin: 0 auto; 58 | display: table; 59 | padding: 5px; 60 | text-align: left; 61 | font-size: 14px; 62 | background-color: #fff; 63 | } 64 | 65 | .consumables_wizard_form { 66 | width: auto; 67 | margin: 0 auto; 68 | } 69 | 70 | .consumables_wizard_form td { 71 | padding: 5px; 72 | } 73 | 74 | .consumables_wizard_red { 75 | margin-left: 5px; 76 | color: red; 77 | } 78 | 79 | .consumables_menu_a { 80 | display: block; 81 | margin: 20px; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /front/wizard.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Consumables\Menu; 31 | use GlpiPlugin\Consumables\Wizard; 32 | use GlpiPlugin\Servicecatalog\Main; 33 | 34 | Session::checkRight('plugin_consumables_request', READ); 35 | 36 | if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { 37 | Html::header(Wizard::getTypeName(2), '', "management", Menu::class); 38 | } else { 39 | if (Plugin::isPluginActive('servicecatalog')) { 40 | Main::showDefaultHeaderHelpdesk(Wizard::getTypeName(2)); 41 | } else { 42 | Html::helpHeader(Wizard::getTypeName(2)); 43 | } 44 | } 45 | 46 | $wizard = new Wizard(); 47 | $wizard->showMenu(); 48 | 49 | if (Session::getCurrentInterface() != 'central' 50 | && Plugin::isPluginActive('servicecatalog')) { 51 | 52 | Main::showNavBarFooter('consumables'); 53 | } 54 | 55 | if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { 56 | Html::footer(); 57 | } else { 58 | Html::helpFooter(); 59 | } 60 | -------------------------------------------------------------------------------- /src/Menu.php: -------------------------------------------------------------------------------- 1 | . 28 | -------------------------------------------------------------------------- 29 | */ 30 | 31 | namespace GlpiPlugin\Consumables; 32 | 33 | use CommonGLPI; 34 | 35 | /** 36 | * Class Menu 37 | */ 38 | class Menu extends CommonGLPI 39 | { 40 | public static $rightname = 'plugin_consumables'; 41 | 42 | /** 43 | * @return string 44 | */ 45 | public static function getMenuName() 46 | { 47 | return _n('Consumable request', 'Consumable requests', 1, 'consumables'); 48 | } 49 | 50 | /** 51 | * @return array 52 | */ 53 | public static function getMenuContent() 54 | { 55 | 56 | $menu = []; 57 | $menu['title'] = self::getMenuName(); 58 | $menu['page'] = Wizard::getSearchURL(false); 59 | if (Wizard::canCreate()) { 60 | $menu['links']['search'] = Wizard::getSearchURL(false); 61 | $menu['links']['add'] = Wizard::getSearchURL(false); 62 | } 63 | 64 | $menu['icon'] = Request::getIcon(); 65 | 66 | return $menu; 67 | } 68 | 69 | public static function removeRightsFromSession() 70 | { 71 | if (isset($_SESSION['glpimenu']['plugins']['types'][Menu::class])) { 72 | unset($_SESSION['glpimenu']['plugins']['types'][Menu::class]); 73 | } 74 | if (isset($_SESSION['glpimenu']['plugins']['content'][Menu::class])) { 75 | unset($_SESSION['glpimenu']['plugins']['content'][Menu::class]); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /front/validation.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Consumables\Menu; 31 | use GlpiPlugin\Consumables\Validation; 32 | use GlpiPlugin\Consumables\Wizard; 33 | use GlpiPlugin\Servicecatalog\Main; 34 | 35 | Session::checkLoginUser(); 36 | 37 | if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { 38 | Html::header(Wizard::getTypeName(2), '', "management", Menu::class); 39 | } else { 40 | if (Plugin::isPluginActive('servicecatalog')) { 41 | Main::showDefaultHeaderHelpdesk(Wizard::getTypeName(2)); 42 | } else { 43 | Html::helpHeader(Wizard::getTypeName(2)); 44 | } 45 | } 46 | 47 | $p = ['criteria' => [ 48 | [ 49 | 'field' => 6, // field index in search options 50 | 'searchtype' => 'equals', // type of search 51 | 'value' => 2, // value to search 52 | ] 53 | ], 54 | 'as_map'=>0]; 55 | $p = Search::manageParams(Validation::getType(), $_GET); 56 | $p["criteria"][0] = [ 57 | 'field' => 6, // field index in search options 58 | 'searchtype' => 'equals', // type of search 59 | 'value' => 2, // value to search 60 | ]; 61 | Search::showList(Validation::class,$p); 62 | 63 | if (Session::getCurrentInterface() != 'central' 64 | && Plugin::isPluginActive('servicecatalog')) { 65 | 66 | Main::showNavBarFooter('consumables'); 67 | } 68 | 69 | if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { 70 | Html::footer(); 71 | } else { 72 | Html::helpFooter(); 73 | } 74 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | 2 | on: 3 | push: 4 | # Sequence of patterns matched against refs/tags 5 | tags: 6 | - '*.*.*' # Push events to matching ex:20.15.10 7 | 8 | name: Create release with tag 9 | env: 10 | TAG_VALUE: ${GITHUB_REF/refs\/tags\//} 11 | jobs: 12 | build: 13 | name: Upload Release Asset 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout code 17 | uses: actions/checkout@v2 18 | - name: Build project # This would actually build your project, using zip for an example artifact 19 | id: build_ 20 | env: 21 | GITHUB_NAME: ${{ github.event.repository.name }} 22 | 23 | 24 | run: sudo apt-get install libxml-xpath-perl;echo $(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/tags\//}'"]/compatibility/text()' $GITHUB_NAME.xml);echo ::set-output name=version_glpi::$(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/tags\//}'"]/compatibility/text()' $GITHUB_NAME.xml); rm -rf $GITHUB_NAME.xml tools wiki screenshots test .git .github ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png;cd ..; tar jcvf glpi-$GITHUB_NAME-${GITHUB_REF/refs\/tags\//}.tar.bz2 $GITHUB_NAME;ls -al;echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//};echo ${{ steps.getxml.outputs.info }}; 25 | # run: rm -rf $GITHUB_NAME.xml tools wiki screenshots test ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png; tar -zcvf glpi-$GITHUB_NAME-$GITHUB_TAG.tar.gz $GITHUB_NAME 26 | - name: Create Release 27 | id: create_release 28 | uses: actions/create-release@v1 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 31 | with: 32 | tag_name: ${{ github.ref }} 33 | release_name: | 34 | GLPI ${{ steps.build_.outputs.version_glpi }} : Version ${{ github.ref }} disponible / available 35 | body : Version ${{ steps.build_.outputs.tag }} released for GLPI ${{ steps.build_.outputs.version_glpi }} 36 | draft: false 37 | prerelease: true 38 | - name: Upload Release Asset 39 | id: upload-release-asset 40 | uses: actions/upload-release-asset@v1 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 43 | GITHUB_NAME: ${{ github.event.repository.name }} 44 | with: 45 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 46 | asset_path: /home/runner/work/${{ github.event.repository.name }}/glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2 47 | asset_name: glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2 48 | asset_content_type: application/zip 49 | 50 | -------------------------------------------------------------------------------- /install/sql/empty-1.0.0.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_profiles' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_profiles`; 5 | CREATE TABLE `glpi_plugin_consumables_profiles` ( 6 | `id` INT(11) NOT NULL AUTO_INCREMENT, 7 | `profiles_id` INT(11) NOT NULL DEFAULT '0' 8 | COMMENT 'RELATION to glpi_profiles (id)', 9 | `consumables` CHAR(1) 10 | COLLATE utf8_unicode_ci DEFAULT NULL, 11 | `consumables_request` CHAR(1) 12 | COLLATE utf8_unicode_ci DEFAULT NULL, 13 | `consumables_for_all` CHAR(1) 14 | COLLATE utf8_unicode_ci DEFAULT NULL, 15 | `consumables_for_group` CHAR(1) 16 | COLLATE utf8_unicode_ci DEFAULT NULL, 17 | `validate` CHAR(1) 18 | COLLATE utf8_unicode_ci DEFAULT NULL, 19 | PRIMARY KEY (`id`), 20 | KEY `profiles_id` (`profiles_id`) 21 | ) 22 | ENGINE = MyISAM 23 | DEFAULT CHARSET = utf8 24 | COLLATE = utf8_unicode_ci; 25 | 26 | -- -------------------------------------------------------- 27 | -- Structure de la table 'glpi_plugin_consumables_requests' 28 | -- -------------------------------------------------------- 29 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 30 | CREATE TABLE `glpi_plugin_consumables_requests` ( 31 | `id` INT(11) NOT NULL AUTO_INCREMENT, 32 | `consumables_id` INT(11) NOT NULL DEFAULT '0', 33 | `consumableitemtypes_id` INT(11) NOT NULL DEFAULT '0', 34 | `requesters_id` INT(11) NOT NULL DEFAULT '0', 35 | `validators_id` INT(11) NOT NULL DEFAULT '0', 36 | `give_itemtype` VARCHAR(255) DEFAULT NULL, 37 | `give_items_id` INT(11) NOT NULL DEFAULT '0', 38 | `status` INT(11) NOT NULL DEFAULT '2', 39 | `number` INT(11) NOT NULL DEFAULT '0', 40 | `end_date` DATETIME DEFAULT NULL, 41 | `date_mod` DATETIME DEFAULT NULL, 42 | PRIMARY KEY (`id`), 43 | KEY `consumables_id` (`consumables_id`), 44 | KEY `requesters_id` (`requesters_id`), 45 | KEY `validators_id` (`validators_id`), 46 | KEY `date_mod` (`date_mod`), 47 | KEY `end_date` (`end_date`) 48 | ) 49 | ENGINE = MyISAM 50 | DEFAULT CHARSET = utf8 51 | COLLATE = utf8_unicode_ci; 52 | 53 | -- -------------------------------------------------------- 54 | -- Structure de la table 'glpi_plugin_consumables_fields' 55 | -- -------------------------------------------------------- 56 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 57 | CREATE TABLE `glpi_plugin_consumables_fields` ( 58 | `id` INT(11) NOT NULL AUTO_INCREMENT, 59 | `consumables_id` INT(11) NOT NULL DEFAULT '0', 60 | `order_ref` VARCHAR(255) DEFAULT NULL, 61 | PRIMARY KEY (`id`), 62 | KEY `consumables_id` (`consumables_id`), 63 | UNIQUE KEY `unicity` (`consumables_id`, `order_ref`) 64 | ) 65 | ENGINE = MyISAM 66 | DEFAULT CHARSET = utf8 67 | COLLATE = utf8_unicode_ci; -------------------------------------------------------------------------------- /install/sql/empty-2.1.2.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_requests' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 5 | CREATE TABLE `glpi_plugin_consumables_requests` ( 6 | `id` int unsigned NOT NULL AUTO_INCREMENT, 7 | `consumableitems_id` int unsigned NOT NULL DEFAULT '0', 8 | `consumableitemtypes_id` int unsigned NOT NULL DEFAULT '0', 9 | `requesters_id` int unsigned NOT NULL DEFAULT '0', 10 | `validators_id` int unsigned NOT NULL DEFAULT '0', 11 | `give_itemtype` varchar(255) DEFAULT NULL, 12 | `give_items_id` int unsigned NOT NULL DEFAULT '0', 13 | `status` int unsigned NOT NULL DEFAULT '2', 14 | `number` int unsigned NOT NULL DEFAULT '0', 15 | `end_date` timestamp NULL DEFAULT NULL, 16 | `date_mod` timestamp NULL DEFAULT NULL, 17 | PRIMARY KEY (`id`), 18 | KEY `consumableitems_id` (`consumableitems_id`), 19 | KEY `requesters_id` (`requesters_id`), 20 | KEY `validators_id` (`validators_id`), 21 | KEY `date_mod` (`date_mod`), 22 | KEY `end_date` (`end_date`) 23 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 24 | 25 | -- -------------------------------------------------------- 26 | -- Structure de la table 'glpi_plugin_consumables_fields' 27 | -- -------------------------------------------------------- 28 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 29 | CREATE TABLE `glpi_plugin_consumables_fields` ( 30 | `id` int unsigned NOT NULL AUTO_INCREMENT, 31 | `consumableitems_id` int unsigned NOT NULL DEFAULT '0', 32 | `order_ref` varchar(255) DEFAULT NULL, 33 | PRIMARY KEY (`id`), 34 | KEY `consumableitems_id` (`consumableitems_id`), 35 | UNIQUE KEY `unicity` (`consumableitems_id`, `order_ref`) 36 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 37 | 38 | -- -------------------------------------------------------- 39 | -- Structure de la table 'glpi_plugin_consumables_options' 40 | -- -------------------------------------------------------- 41 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 42 | CREATE TABLE `glpi_plugin_consumables_options` ( 43 | `id` int unsigned NOT NULL AUTO_INCREMENT, 44 | `consumableitems_id` int unsigned NOT NULL DEFAULT '0', 45 | `groups` longtext collate utf8mb4_unicode_ci DEFAULT NULL, 46 | `max_cart` smallint(6) NOT NULL DEFAULT '0', 47 | PRIMARY KEY (`id`) 48 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 49 | 50 | -- -------------------------------------------------------- 51 | -- Structure de la table 'glpi_plugin_consumables_helpdesks_tiles_consumablespagetiles' 52 | -- -------------------------------------------------------- 53 | DROP TABLE IF EXISTS `glpi_plugin_consumables_helpdesks_tiles_consumablespagetiles`; 54 | CREATE TABLE `glpi_plugin_consumables_helpdesks_tiles_consumablespagetiles` ( 55 | `id` int unsigned NOT NULL AUTO_INCREMENT, 56 | `title` varchar(255) DEFAULT NULL, 57 | `description` text DEFAULT null, 58 | `illustration` varchar(255) DEFAULT NULL, 59 | `url` text DEFAULT NULL, 60 | PRIMARY KEY (`id`) 61 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 62 | -------------------------------------------------------------------------------- /install/sql/empty-1.2.2.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_profiles' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_profiles`; 5 | CREATE TABLE `glpi_plugin_consumables_profiles` ( 6 | `id` int(11) NOT NULL AUTO_INCREMENT, 7 | `profiles_id` int(11) NOT NULL DEFAULT '0' COMMENT 'RELATION to glpi_profiles (id)', 8 | `consumables` char(1) collate utf8_unicode_ci DEFAULT NULL, 9 | `consumables_request` char(1) collate utf8_unicode_ci DEFAULT NULL, 10 | `consumables_for_all` char(1) collate utf8_unicode_ci DEFAULT NULL, 11 | `consumables_for_group` char(1) collate utf8_unicode_ci DEFAULT NULL, 12 | `validate` char(1) collate utf8_unicode_ci DEFAULT NULL, 13 | PRIMARY KEY (`id`), 14 | KEY `profiles_id` (`profiles_id`) 15 | ) ENGINE = MyISAM DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 16 | 17 | -- -------------------------------------------------------- 18 | -- Structure de la table 'glpi_plugin_consumables_requests' 19 | -- -------------------------------------------------------- 20 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 21 | CREATE TABLE `glpi_plugin_consumables_requests` ( 22 | `id` int(11) NOT NULL AUTO_INCREMENT, 23 | `consumables_id` int(11) NOT NULL DEFAULT '0', 24 | `consumableitemtypes_id` int(11) NOT NULL DEFAULT '0', 25 | `requesters_id` int(11) NOT NULL DEFAULT '0', 26 | `validators_id` int(11) NOT NULL DEFAULT '0', 27 | `give_itemtype` varchar(255) DEFAULT NULL, 28 | `give_items_id` int(11) NOT NULL DEFAULT '0', 29 | `status` int(11) NOT NULL DEFAULT '2', 30 | `number` int(11) NOT NULL DEFAULT '0', 31 | `end_date` datetime DEFAULT NULL, 32 | `date_mod` datetime DEFAULT NULL, 33 | PRIMARY KEY (`id`), 34 | KEY `consumables_id` (`consumables_id`), 35 | KEY `requesters_id` (`requesters_id`), 36 | KEY `validators_id` (`validators_id`), 37 | KEY `date_mod` (`date_mod`), 38 | KEY `end_date` (`end_date`) 39 | ) ENGINE = MyISAM DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 40 | 41 | -- -------------------------------------------------------- 42 | -- Structure de la table 'glpi_plugin_consumables_fields' 43 | -- -------------------------------------------------------- 44 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 45 | CREATE TABLE `glpi_plugin_consumables_fields` ( 46 | `id` int(11) NOT NULL AUTO_INCREMENT, 47 | `consumables_id` int(11) NOT NULL DEFAULT '0', 48 | `order_ref` varchar(255) DEFAULT NULL, 49 | PRIMARY KEY (`id`), 50 | KEY `consumables_id` (`consumables_id`), 51 | UNIQUE KEY `unicity` (`consumables_id`, `order_ref`) 52 | ) ENGINE = MyISAM DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 53 | 54 | -- -------------------------------------------------------- 55 | -- Structure de la table 'glpi_plugin_consumables_options' 56 | -- -------------------------------------------------------- 57 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 58 | CREATE TABLE `glpi_plugin_consumables_options` ( 59 | `id` int(11) NOT NULL AUTO_INCREMENT, 60 | `consumables_id` int(11) NOT NULL DEFAULT '0', 61 | `groups` longtext collate utf8_unicode_ci DEFAULT NULL, 62 | `max_cart` smallint(6) NOT NULL DEFAULT '0', 63 | PRIMARY KEY (`id`) 64 | ) ENGINE = MyISAM DEFAULT CHARSET = utf8 collate = utf8_unicode_ci AUTO_INCREMENT = 1; -------------------------------------------------------------------------------- /install/sql/empty-1.4.0.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_profiles' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_profiles`; 5 | CREATE TABLE `glpi_plugin_consumables_profiles` ( 6 | `id` int(11) NOT NULL AUTO_INCREMENT, 7 | `profiles_id` int(11) NOT NULL DEFAULT '0' COMMENT 'RELATION to glpi_profiles (id)', 8 | `consumables` char(1) collate utf8_unicode_ci DEFAULT NULL, 9 | `consumables_request` char(1) collate utf8_unicode_ci DEFAULT NULL, 10 | `consumables_for_all` char(1) collate utf8_unicode_ci DEFAULT NULL, 11 | `consumables_for_group` char(1) collate utf8_unicode_ci DEFAULT NULL, 12 | `validate` char(1) collate utf8_unicode_ci DEFAULT NULL, 13 | PRIMARY KEY (`id`), 14 | KEY `profiles_id` (`profiles_id`) 15 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 16 | 17 | -- -------------------------------------------------------- 18 | -- Structure de la table 'glpi_plugin_consumables_requests' 19 | -- -------------------------------------------------------- 20 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 21 | CREATE TABLE `glpi_plugin_consumables_requests` ( 22 | `id` int(11) NOT NULL AUTO_INCREMENT, 23 | `consumables_id` int(11) NOT NULL DEFAULT '0', 24 | `consumableitemtypes_id` int(11) NOT NULL DEFAULT '0', 25 | `requesters_id` int(11) NOT NULL DEFAULT '0', 26 | `validators_id` int(11) NOT NULL DEFAULT '0', 27 | `give_itemtype` varchar(255) DEFAULT NULL, 28 | `give_items_id` int(11) NOT NULL DEFAULT '0', 29 | `status` int(11) NOT NULL DEFAULT '2', 30 | `number` int(11) NOT NULL DEFAULT '0', 31 | `end_date` datetime DEFAULT NULL, 32 | `date_mod` datetime DEFAULT NULL, 33 | PRIMARY KEY (`id`), 34 | KEY `consumables_id` (`consumables_id`), 35 | KEY `requesters_id` (`requesters_id`), 36 | KEY `validators_id` (`validators_id`), 37 | KEY `date_mod` (`date_mod`), 38 | KEY `end_date` (`end_date`) 39 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 40 | 41 | -- -------------------------------------------------------- 42 | -- Structure de la table 'glpi_plugin_consumables_fields' 43 | -- -------------------------------------------------------- 44 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 45 | CREATE TABLE `glpi_plugin_consumables_fields` ( 46 | `id` int(11) NOT NULL AUTO_INCREMENT, 47 | `consumables_id` int(11) NOT NULL DEFAULT '0', 48 | `order_ref` varchar(255) DEFAULT NULL, 49 | PRIMARY KEY (`id`), 50 | KEY `consumables_id` (`consumables_id`), 51 | UNIQUE KEY `unicity` (`consumables_id`, `order_ref`) 52 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 53 | 54 | -- -------------------------------------------------------- 55 | -- Structure de la table 'glpi_plugin_consumables_options' 56 | -- -------------------------------------------------------- 57 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 58 | CREATE TABLE `glpi_plugin_consumables_options` ( 59 | `id` int(11) NOT NULL AUTO_INCREMENT, 60 | `consumables_id` int(11) NOT NULL DEFAULT '0', 61 | `groups` longtext collate utf8_unicode_ci DEFAULT NULL, 62 | `max_cart` smallint(6) NOT NULL DEFAULT '0', 63 | PRIMARY KEY (`id`) 64 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci AUTO_INCREMENT = 1; -------------------------------------------------------------------------------- /front/wizard.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Consumables\Menu; 31 | use GlpiPlugin\Consumables\Request; 32 | use GlpiPlugin\Consumables\Validation; 33 | use GlpiPlugin\Consumables\Wizard; 34 | use GlpiPlugin\Servicecatalog\Main; 35 | 36 | Session::checkRight('plugin_consumables_request', READ); 37 | 38 | if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { 39 | Html::header(Wizard::getTypeName(2), '', "management", Menu::class); 40 | } else { 41 | if (Plugin::isPluginActive('servicecatalog')) { 42 | Main::showDefaultHeaderHelpdesk(Wizard::getTypeName(2)); 43 | } else { 44 | Html::helpHeader(Wizard::getTypeName(2)); 45 | } 46 | } 47 | 48 | if (!empty($_GET['action'])) { 49 | switch ($_GET['action']) { 50 | case 'consumablerequest': 51 | $consumablerequest = new Request(); 52 | $consumablerequest->showConsumableRequest(); 53 | break; 54 | case 'consumablevalidation': 55 | echo "
"; 56 | echo ""; 57 | echo " "; 58 | echo __("Consumable validation", "consumables"); 59 | echo "
"; 60 | $p = ['criteria' => [ 61 | [ 62 | 'field' => 6, // field index in search options 63 | 'searchtype' => 'equals', // type of search 64 | 'value' => 2, // value to search 65 | ] 66 | ], 67 | 'as_map' => 0]; 68 | $p = Search::manageParams(Validation::getType(), $_GET); 69 | $p["criteria"][0] = [ 70 | 'field' => 6, // field index in search options 71 | 'searchtype' => 'equals', // type of search 72 | 'value' => 2, // value to search 73 | ]; 74 | Search::showList(Validation::class, $p); 75 | break; 76 | } 77 | } 78 | 79 | if (Session::getCurrentInterface() != 'central' 80 | && Plugin::isPluginActive('servicecatalog')) { 81 | 82 | Main::showNavBarFooter('consumables'); 83 | } 84 | 85 | if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { 86 | Html::footer(); 87 | } else { 88 | Html::helpFooter(); 89 | } 90 | -------------------------------------------------------------------------------- /install/sql/empty-1.6.0.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_profiles' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_profiles`; 5 | CREATE TABLE `glpi_plugin_consumables_profiles` ( 6 | `id` int unsigned NOT NULL AUTO_INCREMENT, 7 | `profiles_id` int unsigned NOT NULL DEFAULT '0' COMMENT 'RELATION to glpi_profiles (id)', 8 | `consumables` char(1) collate utf8_unicode_ci DEFAULT NULL, 9 | `consumables_request` char(1) collate utf8_unicode_ci DEFAULT NULL, 10 | `consumables_for_all` char(1) collate utf8_unicode_ci DEFAULT NULL, 11 | `consumables_for_group` char(1) collate utf8_unicode_ci DEFAULT NULL, 12 | `validate` char(1) collate utf8_unicode_ci DEFAULT NULL, 13 | PRIMARY KEY (`id`), 14 | KEY `profiles_id` (`profiles_id`) 15 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 16 | 17 | -- -------------------------------------------------------- 18 | -- Structure de la table 'glpi_plugin_consumables_requests' 19 | -- -------------------------------------------------------- 20 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 21 | CREATE TABLE `glpi_plugin_consumables_requests` ( 22 | `id` int unsigned NOT NULL AUTO_INCREMENT, 23 | `consumables_id` int unsigned NOT NULL DEFAULT '0', 24 | `consumableitemtypes_id` int unsigned NOT NULL DEFAULT '0', 25 | `requesters_id` int unsigned NOT NULL DEFAULT '0', 26 | `validators_id` int unsigned NOT NULL DEFAULT '0', 27 | `give_itemtype` varchar(255) DEFAULT NULL, 28 | `give_items_id` int unsigned NOT NULL DEFAULT '0', 29 | `status` int unsigned NOT NULL DEFAULT '2', 30 | `number` int unsigned NOT NULL DEFAULT '0', 31 | `end_date` timestamp NULL DEFAULT NULL, 32 | `date_mod` timestamp NULL DEFAULT NULL, 33 | PRIMARY KEY (`id`), 34 | KEY `consumables_id` (`consumables_id`), 35 | KEY `requesters_id` (`requesters_id`), 36 | KEY `validators_id` (`validators_id`), 37 | KEY `date_mod` (`date_mod`), 38 | KEY `end_date` (`end_date`) 39 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 40 | 41 | -- -------------------------------------------------------- 42 | -- Structure de la table 'glpi_plugin_consumables_fields' 43 | -- -------------------------------------------------------- 44 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 45 | CREATE TABLE `glpi_plugin_consumables_fields` ( 46 | `id` int unsigned NOT NULL AUTO_INCREMENT, 47 | `consumables_id` int unsigned NOT NULL DEFAULT '0', 48 | `order_ref` varchar(255) DEFAULT NULL, 49 | PRIMARY KEY (`id`), 50 | KEY `consumables_id` (`consumables_id`), 51 | UNIQUE KEY `unicity` (`consumables_id`, `order_ref`) 52 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci; 53 | 54 | -- -------------------------------------------------------- 55 | -- Structure de la table 'glpi_plugin_consumables_options' 56 | -- -------------------------------------------------------- 57 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 58 | CREATE TABLE `glpi_plugin_consumables_options` ( 59 | `id` int unsigned NOT NULL AUTO_INCREMENT, 60 | `consumables_id` int unsigned NOT NULL DEFAULT '0', 61 | `groups` longtext collate utf8_unicode_ci DEFAULT NULL, 62 | `max_cart` smallint NOT NULL DEFAULT '0', 63 | PRIMARY KEY (`id`) 64 | ) ENGINE = InnoDB DEFAULT CHARSET = utf8 collate = utf8_unicode_ci AUTO_INCREMENT = 1; 65 | -------------------------------------------------------------------------------- /src/Servicecatalog.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Consumables; 31 | 32 | use CommonGLPI; 33 | use Session; 34 | 35 | if (!defined('GLPI_ROOT')) { 36 | die("Sorry. You can't access directly to this file"); 37 | } 38 | 39 | 40 | /** 41 | * Class Servicecatalog 42 | */ 43 | class Servicecatalog extends CommonGLPI 44 | { 45 | 46 | public static $rightname = 'plugin_consumables_request'; 47 | 48 | public $dohistory = false; 49 | 50 | /** 51 | * @return bool 52 | */ 53 | public static function canUse() 54 | { 55 | return Session::haveRight("plugin_consumables_request", 1); 56 | } 57 | 58 | /** 59 | * @return string 60 | */ 61 | public static function getMenuLink() 62 | { 63 | 64 | return PLUGIN_CONSUMABLES_WEBDIR . "/front/wizard.php"; 65 | } 66 | 67 | /** 68 | * @return string 69 | */ 70 | public static function getNavBarLink() 71 | { 72 | global $CFG_GLPI; 73 | 74 | return PLUGIN_CONSUMABLES_WEBDIR . "/front/wizard.php"; 75 | } 76 | 77 | /** 78 | * @return string 79 | */ 80 | public static function getMenuTitle() 81 | { 82 | return _n('Consumable request', 'Consumable requests', 2, 'consumables'); 83 | } 84 | 85 | /** 86 | * @return string 87 | */ 88 | public static function getMenuLogo() 89 | { 90 | 91 | return Request::getIcon(); 92 | } 93 | 94 | /** 95 | * @return string 96 | * @throws \GlpitestSQLError 97 | */ 98 | public static function getMenuLogoCss() 99 | { 100 | 101 | $addstyle = "font-size: 4.5em;"; 102 | return $addstyle; 103 | } 104 | 105 | /** 106 | * @return string 107 | */ 108 | public static function getMenuComment() 109 | { 110 | 111 | return __('Make a consumable request', 'consumables'); 112 | } 113 | 114 | /** 115 | * @return string 116 | */ 117 | public static function getLinkList() 118 | { 119 | return ""; 120 | } 121 | 122 | /** 123 | * @return string 124 | */ 125 | public static function getList() 126 | { 127 | return ""; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /install/sql/empty-2.0.0.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_profiles' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_profiles`; 5 | CREATE TABLE `glpi_plugin_consumables_profiles` ( 6 | `id` int unsigned NOT NULL AUTO_INCREMENT, 7 | `profiles_id` int unsigned NOT NULL DEFAULT '0' COMMENT 'RELATION to glpi_profiles (id)', 8 | `consumables` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 9 | `consumables_request` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 10 | `consumables_for_all` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 11 | `consumables_for_group` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 12 | `validate` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 13 | PRIMARY KEY (`id`), 14 | KEY `profiles_id` (`profiles_id`) 15 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 16 | 17 | -- -------------------------------------------------------- 18 | -- Structure de la table 'glpi_plugin_consumables_requests' 19 | -- -------------------------------------------------------- 20 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 21 | CREATE TABLE `glpi_plugin_consumables_requests` ( 22 | `id` int unsigned NOT NULL AUTO_INCREMENT, 23 | `consumables_id` int unsigned NOT NULL DEFAULT '0', 24 | `consumableitemtypes_id` int unsigned NOT NULL DEFAULT '0', 25 | `requesters_id` int unsigned NOT NULL DEFAULT '0', 26 | `validators_id` int unsigned NOT NULL DEFAULT '0', 27 | `give_itemtype` varchar(255) DEFAULT NULL, 28 | `give_items_id` int unsigned NOT NULL DEFAULT '0', 29 | `status` int unsigned NOT NULL DEFAULT '2', 30 | `number` int unsigned NOT NULL DEFAULT '0', 31 | `end_date` timestamp NULL DEFAULT NULL, 32 | `date_mod` timestamp NULL DEFAULT NULL, 33 | PRIMARY KEY (`id`), 34 | KEY `consumables_id` (`consumables_id`), 35 | KEY `requesters_id` (`requesters_id`), 36 | KEY `validators_id` (`validators_id`), 37 | KEY `date_mod` (`date_mod`), 38 | KEY `end_date` (`end_date`) 39 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 40 | 41 | -- -------------------------------------------------------- 42 | -- Structure de la table 'glpi_plugin_consumables_fields' 43 | -- -------------------------------------------------------- 44 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 45 | CREATE TABLE `glpi_plugin_consumables_fields` ( 46 | `id` int unsigned NOT NULL AUTO_INCREMENT, 47 | `consumables_id` int unsigned NOT NULL DEFAULT '0', 48 | `order_ref` varchar(255) DEFAULT NULL, 49 | PRIMARY KEY (`id`), 50 | KEY `consumables_id` (`consumables_id`), 51 | UNIQUE KEY `unicity` (`consumables_id`, `order_ref`) 52 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 53 | 54 | -- -------------------------------------------------------- 55 | -- Structure de la table 'glpi_plugin_consumables_options' 56 | -- -------------------------------------------------------- 57 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 58 | CREATE TABLE `glpi_plugin_consumables_options` ( 59 | `id` int unsigned NOT NULL AUTO_INCREMENT, 60 | `consumables_id` int unsigned NOT NULL DEFAULT '0', 61 | `groups` longtext collate utf8mb4_unicode_ci DEFAULT NULL, 62 | `max_cart` smallint(6) NOT NULL DEFAULT '0', 63 | PRIMARY KEY (`id`) 64 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 65 | -------------------------------------------------------------------------------- /install/sql/empty-2.0.1.sql: -------------------------------------------------------------------------------- 1 | -- -------------------------------------------------------- 2 | -- Structure de la table 'glpi_plugin_consumables_profiles' 3 | -- -------------------------------------------------------- 4 | DROP TABLE IF EXISTS `glpi_plugin_consumables_profiles`; 5 | CREATE TABLE `glpi_plugin_consumables_profiles` ( 6 | `id` int unsigned NOT NULL AUTO_INCREMENT, 7 | `profiles_id` int unsigned NOT NULL DEFAULT '0' COMMENT 'RELATION to glpi_profiles (id)', 8 | `consumables` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 9 | `consumables_request` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 10 | `consumables_for_all` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 11 | `consumables_for_group` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 12 | `validate` char(1) collate utf8mb4_unicode_ci DEFAULT NULL, 13 | PRIMARY KEY (`id`), 14 | KEY `profiles_id` (`profiles_id`) 15 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 16 | 17 | -- -------------------------------------------------------- 18 | -- Structure de la table 'glpi_plugin_consumables_requests' 19 | -- -------------------------------------------------------- 20 | DROP TABLE IF EXISTS `glpi_plugin_consumables_requests`; 21 | CREATE TABLE `glpi_plugin_consumables_requests` ( 22 | `id` int unsigned NOT NULL AUTO_INCREMENT, 23 | `consumableitems_id` int unsigned NOT NULL DEFAULT '0', 24 | `consumableitemtypes_id` int unsigned NOT NULL DEFAULT '0', 25 | `requesters_id` int unsigned NOT NULL DEFAULT '0', 26 | `validators_id` int unsigned NOT NULL DEFAULT '0', 27 | `give_itemtype` varchar(255) DEFAULT NULL, 28 | `give_items_id` int unsigned NOT NULL DEFAULT '0', 29 | `status` int unsigned NOT NULL DEFAULT '2', 30 | `number` int unsigned NOT NULL DEFAULT '0', 31 | `end_date` timestamp NULL DEFAULT NULL, 32 | `date_mod` timestamp NULL DEFAULT NULL, 33 | PRIMARY KEY (`id`), 34 | KEY `consumableitems_id` (`consumableitems_id`), 35 | KEY `requesters_id` (`requesters_id`), 36 | KEY `validators_id` (`validators_id`), 37 | KEY `date_mod` (`date_mod`), 38 | KEY `end_date` (`end_date`) 39 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 40 | 41 | -- -------------------------------------------------------- 42 | -- Structure de la table 'glpi_plugin_consumables_fields' 43 | -- -------------------------------------------------------- 44 | DROP TABLE IF EXISTS `glpi_plugin_consumables_fields`; 45 | CREATE TABLE `glpi_plugin_consumables_fields` ( 46 | `id` int unsigned NOT NULL AUTO_INCREMENT, 47 | `consumableitems_id` int unsigned NOT NULL DEFAULT '0', 48 | `order_ref` varchar(255) DEFAULT NULL, 49 | PRIMARY KEY (`id`), 50 | KEY `consumableitems_id` (`consumableitems_id`), 51 | UNIQUE KEY `unicity` (`consumableitems_id`, `order_ref`) 52 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 53 | 54 | -- -------------------------------------------------------- 55 | -- Structure de la table 'glpi_plugin_consumables_options' 56 | -- -------------------------------------------------------- 57 | DROP TABLE IF EXISTS `glpi_plugin_consumables_options`; 58 | CREATE TABLE `glpi_plugin_consumables_options` ( 59 | `id` int unsigned NOT NULL AUTO_INCREMENT, 60 | `consumableitems_id` int unsigned NOT NULL DEFAULT '0', 61 | `groups` longtext collate utf8mb4_unicode_ci DEFAULT NULL, 62 | `max_cart` smallint(6) NOT NULL DEFAULT '0', 63 | PRIMARY KEY (`id`) 64 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; 65 | -------------------------------------------------------------------------------- /ajax/request.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Consumables\Request; 31 | use GlpiPlugin\Consumables\Validation; 32 | 33 | Session::checkRight('plugin_consumables_request', 1); 34 | Session::checkLoginUser(); 35 | 36 | switch ($_POST['action']) { 37 | case 'addToCart': 38 | header('Content-Type: application/json; charset=UTF-8"'); 39 | $request = new Request(); 40 | echo json_encode($request->addToCart($_POST)); 41 | break; 42 | 43 | case 'addConsumables': 44 | header('Content-Type: application/json; charset=UTF-8"'); 45 | $request = new Request(); 46 | echo json_encode($request->addConsumables($_POST)); 47 | break; 48 | 49 | case 'reloadAvailableConsumables': 50 | header("Content-Type: text/html; charset=UTF-8"); 51 | $request = new Request(); 52 | $request->loadAvailableConsumables($_POST['type']); 53 | break; 54 | 55 | case 'seeConsumablesInfos': 56 | header("Content-Type: text/html; charset=UTF-8"); 57 | $request = new Request(); 58 | $request->seeConsumablesInfos($_POST['consumableitems_id']); 59 | break; 60 | 61 | case 'reloadAvailableConsumablesNumber': 62 | header("Content-Type: text/html; charset=UTF-8"); 63 | $request = new Request(); 64 | $request->loadAvailableConsumablesNumber(json_decode(stripslashes($_POST['used'])), $_POST['consumableitems_id']); 65 | break; 66 | 67 | // case 'loadConsumableInformation': 68 | // header("Content-Type: text/html; charset=UTF-8"); 69 | // $validation = new Validation(); 70 | // $validation->loadConsumableInformation(Session::getLoginUserID(), $_POST['consumableitems_id']); 71 | // break; 72 | 73 | case 'validationConsumables': 74 | header('Content-Type: application/json; charset=UTF-8"'); 75 | $validation = new Validation(); 76 | echo json_encode($validation->validationConsumable($_POST)); 77 | break; 78 | 79 | case 'searchConsumables': 80 | header('Content-Type: application/json; charset=UTF-8"'); 81 | $request = new Request(); 82 | echo json_encode($request->listItemsForUserOrGroup($_POST['requesters_id'], $_POST['type'], $_POST)); 83 | break; 84 | 85 | case 'loadAvailableConsumablesNumber': 86 | $request = new Request(); 87 | $request->loadAvailableConsumablesNumber(0, $_POST['consumableitems_id']); 88 | break; 89 | } 90 | -------------------------------------------------------------------------------- /ajax/dropdownAllItems.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | header("Content-Type: text/html; charset=UTF-8"); 31 | Html::header_nocache(); 32 | Session::checkLoginUser(); 33 | 34 | global $CFG_GLPI; 35 | 36 | // Make a select box 37 | if ($_POST["idtable"] && class_exists($_POST["idtable"])) { 38 | $dbu = new DbUtils(); 39 | $table = $dbu->getTableForItemType($_POST["idtable"]); 40 | 41 | // Link to user for search only > normal users 42 | $link = "getDropdownValue.php"; 43 | 44 | if ($_POST["idtable"] == 'User') { 45 | $link = "getDropdownUsers.php"; 46 | } 47 | 48 | $rand = mt_rand(); 49 | 50 | $field_id = Html::cleanId("dropdown_" . $_POST["name"] . $rand); 51 | 52 | $p = [ 53 | 'value' => 0, 54 | 'valuename' => Dropdown::EMPTY_VALUE, 55 | 'itemtype' => $_POST["idtable"], 56 | 'display_emptychoice' => true, 57 | 'displaywith' => ['otherserial', 'serial'], 58 | '_idor_token' => Session::getNewIDORToken($_POST["idtable"]), 59 | ]; 60 | if (isset($_POST['value'])) { 61 | $p['value'] = $_POST['value']; 62 | } 63 | if (isset($_POST['entity_restrict'])) { 64 | $p['entity_restrict'] = $_POST['entity_restrict']; 65 | } 66 | if (isset($_POST['condition'])) { 67 | $p['condition'] = $_POST['condition']; 68 | } 69 | if ($_POST['idtable'] == 'Group') { 70 | $groups = Group_User::getUserGroups(Session::getLoginUserID()); 71 | $user_groups = []; 72 | foreach ($groups as $group) { 73 | $user_groups[] = $group['id']; 74 | } 75 | $p['condition'] = Dropdown::addNewCondition(["id" =>$user_groups]); 76 | } 77 | 78 | echo Html::jsAjaxDropdown( 79 | $_POST["name"], 80 | $field_id, 81 | $CFG_GLPI['root_doc'] . "/ajax/" . $link, 82 | $p 83 | ); 84 | 85 | if (!empty($_POST['showItemSpecificity'])) { 86 | $params = ['items_id' => '__VALUE__', 87 | 'itemtype' => $_POST["idtable"]]; 88 | if (isset($_POST['entity_restrict'])) { 89 | $params['entity_restrict'] = $_POST['entity_restrict']; 90 | } 91 | 92 | Ajax::updateItemOnSelectEvent( 93 | $field_id, 94 | "showItemSpecificity_" . $_POST["name"] . "$rand", 95 | $_POST['showItemSpecificity'], 96 | $params 97 | ); 98 | 99 | echo "
 \n"; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/Field.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Consumables; 31 | 32 | use CommonDBTM; 33 | use ConsumableItem; 34 | use Html; 35 | 36 | if (!defined('GLPI_ROOT')) { 37 | die("Sorry. You can't access directly to this file"); 38 | } 39 | 40 | /** 41 | * Class Field 42 | * 43 | * This class shows the plugin main page 44 | * 45 | * @package Consumables 46 | * @author Ludovic Dupont 47 | */ 48 | class Field extends CommonDBTM 49 | { 50 | 51 | static $types = ['ConsumableItem']; 52 | static $rightname = "plugin_consumables"; 53 | 54 | 55 | /** 56 | * @param int $nb 57 | * 58 | * @return string 59 | */ 60 | static function getTypeName($nb = 0) 61 | { 62 | return _n('Consumable request', 'Consumable requests', 1, 'consumables'); 63 | } 64 | 65 | 66 | /** 67 | * Show order reference field 68 | * 69 | * @param $params 70 | */ 71 | public static function addFieldOrderReference($params) 72 | { 73 | 74 | $item = $params['item']; 75 | 76 | if (!in_array($item::getType(), self::$types)) { 77 | return false; 78 | } 79 | $consumableitems_id = $item->getID(); 80 | $field = new self(); 81 | if ($field->getFromDBByCrit(["consumableitems_id" => $consumableitems_id])) { 82 | echo "
"; 83 | echo ""; 86 | echo "
"; 87 | echo Html::input('name', ['value' => $field->fields['order_ref'], 'size' => 40]); 88 | echo "
"; 89 | echo "
"; 90 | } 91 | } 92 | 93 | /** 94 | * Post add consumable 95 | * 96 | * @param ConsumableItem $consumableItem 97 | */ 98 | static function postAddConsumable(ConsumableItem $consumableItem) 99 | { 100 | 101 | $field = new self(); 102 | if (isset($consumableItem->input['order_ref'])) { 103 | $field->add(['consumableitems_id' => $consumableItem->fields['id'], 104 | 'order_ref' => $consumableItem->input['order_ref']]); 105 | } 106 | } 107 | 108 | /** 109 | * Pre update consumable 110 | * 111 | * @param ConsumableItem $consumableItem 112 | */ 113 | static function preUpdateConsumable(ConsumableItem $consumableItem) 114 | { 115 | 116 | $field = new self(); 117 | $field->getFromDBByCrit(["consumableitems_id" => $consumableItem->input['id']]); 118 | 119 | if (!empty($field->fields)) { 120 | $field->update(['id' => $field->fields['id'], 121 | 'order_ref' => $consumableItem->input['order_ref']]); 122 | } else { 123 | self::postAddConsumable($consumableItem); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/Wizard.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | namespace GlpiPlugin\Consumables; 31 | 32 | use CommonDBTM; 33 | 34 | if (!defined('GLPI_ROOT')) { 35 | die("Sorry. You can't access directly to this file"); 36 | } 37 | 38 | /** 39 | * Class Wizard 40 | * 41 | */ 42 | class Wizard extends CommonDBTM 43 | { 44 | 45 | public static $rightname = "plugin_consumables"; 46 | 47 | /** 48 | * @param int $nb 49 | * 50 | * @return string 51 | */ 52 | public static function getTypeName($nb = 0) 53 | { 54 | return __('Consumables wizard', 'consumables'); 55 | } 56 | 57 | /** 58 | * Show config menu 59 | */ 60 | public function showMenu() 61 | { 62 | 63 | $request = new Request(); 64 | 65 | if (!$this->canView() && !$request->canRequest()) { 66 | return false; 67 | } 68 | 69 | echo "

"; 73 | 74 | echo "
"; 75 | // Consumable request 76 | if ($request->canRequest()) { 77 | echo "
"; 78 | echo ""; 79 | echo ""; 80 | echo "

" . __("Consumable request", "consumables") . "
"; 81 | echo "
"; 82 | } 83 | 84 | if ($request->canValidate()) { 85 | echo "
"; 86 | // Consumable validation 87 | echo "
"; 88 | echo ""; 89 | echo ""; 90 | echo "

" . __("Consumable validation", "consumables") . "
"; 91 | echo "
"; 92 | } 93 | echo "
"; 94 | } 95 | 96 | /** 97 | * Show wizard form of the current step 98 | * 99 | * @param $step 100 | */ 101 | public function showWizard($step) 102 | { 103 | 104 | echo "
"; 105 | switch ($step) { 106 | case 'consumablerequest': 107 | $consumablerequest = new Request(); 108 | $consumablerequest->showConsumableRequest(); 109 | break; 110 | case 'consumablevalidation': 111 | $consumablevalidation = new Validation(); 112 | $consumablevalidation->showConsumableValidation(); 113 | break; 114 | } 115 | echo "
"; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /locales/glpi.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI - Consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2025-11-28 14:06+0000\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 20 | 21 | #: hook.php:184 src/Field.php:84 22 | msgid "Order reference" 23 | msgstr "" 24 | 25 | #: hook.php:192 hook.php:221 src/Option.php:126 src/Option.php:322 26 | msgid "Maximum number allowed for request" 27 | msgstr "" 28 | 29 | #: hook.php:201 src/Option.php:147 30 | msgid "Allowed groups for request" 31 | msgstr "" 32 | 33 | #: hook.php:223 src/Option.php:199 src/Option.php:332 34 | msgid "Add a group for request" 35 | msgstr "" 36 | 37 | #: setup.php:107 src/Field.php:62 src/Menu.php:47 38 | #: src/NotificationTargetRequest.php:64 src/NotificationTargetRequest.php:91 39 | #: src/Request.php:68 src/Request.php:470 src/Request.php:477 40 | #: src/Servicecatalog.php:82 src/Wizard.php:71 src/Wizard.php:80 41 | msgid "Consumable request" 42 | msgid_plural "Consumable requests" 43 | msgstr[0] "" 44 | msgstr[1] "" 45 | 46 | #: front/wizard.form.php:58 src/NotificationTargetRequest.php:65 47 | #: src/NotificationTargetRequest.php:94 src/Profile.php:174 src/Profile.php:237 48 | #: src/Validation.php:141 src/Validation.php:168 src/Wizard.php:90 49 | msgid "Consumable validation" 50 | msgstr "" 51 | 52 | #: src/NotificationTargetRequest.php:88 src/NotificationTargetRequest.php:153 53 | msgid "Consumable ID" 54 | msgstr "" 55 | 56 | #: src/NotificationTargetRequest.php:154 57 | msgid "Type of event" 58 | msgstr "" 59 | 60 | #: src/NotificationTargetRequest.php:179 61 | msgid "Display each consumable" 62 | msgstr "" 63 | 64 | #: src/NotificationTargetRequest.php:195 65 | msgid "Consumable approver" 66 | msgstr "" 67 | 68 | #: src/NotificationTargetRequest.php:196 69 | msgid "Consumable requester" 70 | msgstr "" 71 | 72 | #: src/NotificationTargetRequest.php:197 73 | msgid "Consumable recipient" 74 | msgstr "" 75 | 76 | #: src/Option.php:63 77 | msgid "Consumable request options" 78 | msgstr "" 79 | 80 | #: src/Option.php:134 81 | msgctxt "button" 82 | msgid "Define" 83 | msgstr "" 84 | 85 | #: src/Profile.php:166 86 | msgid "Advanced" 87 | msgstr "" 88 | 89 | #: src/Profile.php:178 src/Profile.php:229 src/Servicecatalog.php:111 90 | msgid "Make a consumable request" 91 | msgstr "" 92 | 93 | #: src/Profile.php:186 94 | msgid "Make a consumable request for all users" 95 | msgstr "" 96 | 97 | #: src/Profile.php:191 98 | msgid "Make a consumable request for my groups" 99 | msgstr "" 100 | 101 | #: src/Profile.php:218 102 | msgid "Consumable" 103 | msgid_plural "Consumables" 104 | msgstr[0] "" 105 | msgstr[1] "" 106 | 107 | #: src/Profile.php:225 108 | msgid "Make a consumable request for users" 109 | msgstr "" 110 | 111 | #: src/Profile.php:233 112 | msgid "Make a consumable request for groups" 113 | msgstr "" 114 | 115 | #: src/Request.php:248 src/Request.php:404 src/Request.php:440 116 | msgid "Consumable request report" 117 | msgstr "" 118 | 119 | #: src/Request.php:287 120 | msgid "Consumable requests history" 121 | msgstr "" 122 | 123 | #: src/Request.php:319 124 | msgid "Consumables request search" 125 | msgstr "" 126 | 127 | #: src/Request.php:507 src/Request.php:552 src/Request.php:974 128 | #: src/Validation.php:100 src/Validation.php:214 129 | msgid "Number" 130 | msgstr "" 131 | 132 | #: src/Request.php:538 133 | msgid "Add to cart" 134 | msgstr "" 135 | 136 | #: src/Request.php:547 137 | msgid "Cart" 138 | msgstr "" 139 | 140 | #: src/Request.php:916 141 | msgid "Consumable affected" 142 | msgid_plural "Consumables affected" 143 | msgstr[0] "" 144 | msgstr[1] "" 145 | 146 | #: src/Request.php:936 147 | msgid "Please add consumables in cart" 148 | msgstr "" 149 | 150 | #: src/Validation.php:349 151 | msgid "Refuse" 152 | msgstr "" 153 | 154 | #: src/Validation.php:456 155 | #, php-format 156 | msgid "Not enough stock for consumable %s" 157 | msgstr "" 158 | 159 | #: src/Wizard.php:54 160 | msgid "Consumables wizard" 161 | msgstr "" 162 | -------------------------------------------------------------------------------- /locales/el_GR.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Evangelos Mamalakis , 2018 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI Project - consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 12 | "PO-Revision-Date: 2020-07-21 09:58+0000\n" 13 | "Last-Translator: Xavier CAILLAUD \n" 14 | "Language-Team: Greek (Greece) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/el_GR/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: el_GR\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: hook.php:166 inc/field.class.php:75 22 | msgid "Order reference" 23 | msgstr "" 24 | 25 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 26 | msgid "Maximum number allowed for request" 27 | msgstr "Μέγιστος επιτρεπτός αριθμός για το αίτημα" 28 | 29 | #: hook.php:188 inc/option.class.php:133 30 | msgid "Allowed groups for request" 31 | msgstr "Επιτρεπόμενες ομάδες για αίτημα" 32 | 33 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 34 | msgid "Add a group for request" 35 | msgstr "Προσθήκη ομάδας για αίτημα" 36 | 37 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 38 | #: inc/notificationtargetrequest.class.php:51 39 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 40 | #: inc/request.class.php:390 inc/request.class.php:396 41 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 42 | #: inc/wizard.class.php:79 43 | msgid "Consumable request" 44 | msgid_plural "Consumable requests" 45 | msgstr[0] "Αίτημα αναλώσιμου" 46 | msgstr[1] "Αιτήματα αναλωσίμων" 47 | 48 | #: inc/notificationtargetrequest.class.php:52 49 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 50 | #: inc/profile.class.php:210 inc/validation.class.php:64 51 | #: inc/validation.class.php:91 inc/wizard.class.php:87 52 | msgid "Consumable validation" 53 | msgstr "Πιστοποίηση αναλωσίμου" 54 | 55 | #: inc/notificationtargetrequest.class.php:63 56 | #: inc/notificationtargetrequest.class.php:109 57 | msgid "Consumable ID" 58 | msgstr "ID Αναλωσίμου" 59 | 60 | #: inc/notificationtargetrequest.class.php:110 61 | msgid "Type of event" 62 | msgstr "Τύπος γεγονότος" 63 | 64 | #: inc/notificationtargetrequest.class.php:130 65 | msgid "Display each consumable" 66 | msgstr "Προβολή κάθε αναλώσιμου" 67 | 68 | #: inc/notificationtargetrequest.class.php:145 69 | msgid "Consumable approver" 70 | msgstr "Εγγκριτής αναλώσιμου" 71 | 72 | #: inc/notificationtargetrequest.class.php:146 73 | msgid "Consumable requester" 74 | msgstr "Αιτών αναλωσίμου" 75 | 76 | #: inc/notificationtargetrequest.class.php:147 77 | msgid "Consumable recipient" 78 | msgstr "" 79 | 80 | #: inc/option.class.php:51 81 | msgid "Consumable request options" 82 | msgstr "Επιλογές αίτησης αναλωσίμου" 83 | 84 | #: inc/option.class.php:120 85 | msgctxt "button" 86 | msgid "Define" 87 | msgstr "Ορισμός" 88 | 89 | #: inc/profile.class.php:146 90 | msgid "Advanced" 91 | msgstr "Για προχωρημένους" 92 | 93 | #: inc/profile.class.php:158 inc/profile.class.php:202 94 | #: inc/servicecatalog.class.php:81 95 | msgid "Make a consumable request" 96 | msgstr "Κάντε ένα αίτημα αναλωσίμου" 97 | 98 | #: inc/profile.class.php:166 99 | msgid "Make a consumable request for all users" 100 | msgstr "" 101 | 102 | #: inc/profile.class.php:171 103 | msgid "Make a consumable request for my groups" 104 | msgstr "" 105 | 106 | #: inc/profile.class.php:191 107 | msgid "Consumable" 108 | msgid_plural "Consumables" 109 | msgstr[0] "" 110 | msgstr[1] "" 111 | 112 | #: inc/profile.class.php:198 113 | msgid "Make a consumable request for users" 114 | msgstr "" 115 | 116 | #: inc/profile.class.php:206 117 | msgid "Make a consumable request for groups" 118 | msgstr "" 119 | 120 | #: inc/request.class.php:177 inc/request.class.php:326 121 | #: inc/request.class.php:362 122 | msgid "Consumable request report" 123 | msgstr "" 124 | 125 | #: inc/request.class.php:216 126 | msgid "Consumable requests history" 127 | msgstr "" 128 | 129 | #: inc/request.class.php:248 130 | msgid "Consumables request search" 131 | msgstr "" 132 | 133 | #: inc/request.class.php:422 inc/request.class.php:467 134 | #: inc/request.class.php:830 inc/validation.class.php:129 135 | msgid "Number" 136 | msgstr "" 137 | 138 | #: inc/request.class.php:453 139 | msgid "Add to cart" 140 | msgstr "" 141 | 142 | #: inc/request.class.php:462 143 | msgid "Cart" 144 | msgstr "" 145 | 146 | #: inc/request.class.php:776 147 | msgid "Consumable affected" 148 | msgid_plural "Consumables affected" 149 | msgstr[0] "" 150 | msgstr[1] "" 151 | 152 | #: inc/request.class.php:793 153 | msgid "Please add consumables in cart" 154 | msgstr "" 155 | 156 | #: inc/validation.class.php:255 157 | msgid "Refuse" 158 | msgstr "" 159 | 160 | #: inc/validation.class.php:350 161 | #, php-format 162 | msgid "Not enough stock for consumable %s" 163 | msgstr "" 164 | 165 | #: inc/wizard.class.php:52 166 | msgid "Consumables wizard" 167 | msgstr "" 168 | -------------------------------------------------------------------------------- /consumables.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Consumables 4 | consumables 5 | stable 6 | https://raw.githubusercontent.com/InfotelGLPI/consumables/master/consumables.png 7 | 8 | 9 | 10 | 11 | 12 | 13 | - Système de validation de demande de consommables,
- Notifications associées,
- Wizard utilisateur basé sur le stock disponible.]]>
14 | - Validation system of consumable request,
- Associated notifications,
- Wizard user based on available stock.]]>
15 |
16 |
17 | https://github.com/InfotelGLPI/consumables 18 | https://github.com/InfotelGLPI/consumables/releases 19 | https://github.com/InfotelGLPI/consumables/issues 20 | https://raw.githubusercontent.com/InfotelGLPI/consumables/master/README.md 21 | 22 | Ludovic Dupont 23 | Infotel 24 | 25 | 26 | 27 | 2.1.2 28 | ~11.0 29 | https://github.com/InfotelGLPI/consumables/releases/download/2.1.2/glpi-consumables-2.1.2.tar.bz2 30 | 31 | 32 | 2.1.1 33 | ~11.0 34 | https://github.com/InfotelGLPI/consumables/releases/download/2.1.1/glpi-consumables-2.1.1.tar.bz2 35 | 36 | 37 | 2.1.0 38 | ~11.0 39 | https://github.com/InfotelGLPI/consumables/releases/download/2.1.0/glpi-consumables-2.1.0.tar.bz2 40 | 41 | 42 | 2.0.1 43 | ~10.0 44 | https://github.com/InfotelGLPI/consumables/releases/download/2.0.1/glpi-consumables-2.0.1.tar.bz2 45 | 46 | 47 | 2.0.0 48 | ~10.0 49 | https://github.com/InfotelGLPI/consumables/releases/download/2.0.0/glpi-consumables-2.0.0.tar.bz2 50 | 51 | 52 | 2.0.0-rc1 53 | ~10.0 54 | https://github.com/InfotelGLPI/consumables/releases/download/2.0.0-rc1/glpi-consumables-2.0.0-rc1.tar.bz2 55 | 56 | 57 | 1.6.0 58 | 9.5 59 | 60 | 61 | 1.5.0 62 | 9.4 63 | 64 | 65 | 1.4.2 66 | 9.3 67 | 68 | 69 | 1.4.1 70 | 9.3 71 | 72 | 73 | 1.4.0 74 | 9.3 75 | 76 | 77 | 1.3.1 78 | 9.2 79 | 80 | 81 | 1.3.0 82 | 9.2 83 | 84 | 85 | 1.2.0 86 | 9.1 87 | 88 | 89 | 1.1.0 90 | 0.90 91 | 92 | 93 | 94 | cs_CZ 95 | en_GB 96 | es_419 97 | es_ES 98 | fi_FI 99 | fr_FR 100 | pl_PL 101 | pt_BR 102 | pt_PT 103 | ru_RU 104 | 105 | 106 | 107 | 108 | consommable 109 | 110 | 111 | consumable 112 | 113 | 114 | 115 | 116 | https://raw.githubusercontent.com/InfotelGLPI/consumables/master/wiki/Menu%20plugin%20consumables.png 117 | 118 | 119 | https://raw.githubusercontent.com/InfotelGLPI/consumables/master/wiki/Wizard%20plugin%20consumables.png 120 | 121 | 122 |
123 | -------------------------------------------------------------------------------- /setup.php: -------------------------------------------------------------------------------- 1 | . 28 | -------------------------------------------------------------------------- 29 | */ 30 | 31 | global $CFG_GLPI; 32 | 33 | use Glpi\Helpdesk\Tile\TilesManager; 34 | use Glpi\Plugin\Hooks; 35 | use GlpiPlugin\Consumables\Field; 36 | use GlpiPlugin\Consumables\Helpdesk\Tile\ConsumablesPageTile; 37 | use GlpiPlugin\Consumables\Menu; 38 | use GlpiPlugin\Consumables\Profile; 39 | use GlpiPlugin\Consumables\Request; 40 | use GlpiPlugin\Consumables\Servicecatalog; 41 | use GlpiPlugin\Consumables\Validation; 42 | use GlpiPlugin\Servicecatalog\Main; 43 | 44 | define('PLUGIN_CONSUMABLES_VERSION', '2.1.2'); 45 | 46 | if (!defined("PLUGIN_CONSUMABLES_DIR")) { 47 | define("PLUGIN_CONSUMABLES_DIR", Plugin::getPhpDir("consumables")); 48 | } 49 | if (!defined("PLUGIN_CONSUMABLES_WEBDIR")) { 50 | $root = $CFG_GLPI['root_doc'] . '/plugins/consumables'; 51 | define("PLUGIN_CONSUMABLES_WEBDIR", $root); 52 | } 53 | 54 | // Init the hooks of the plugins -Needed 55 | function plugin_init_consumables() 56 | { 57 | global $PLUGIN_HOOKS,$CFG_GLPI; 58 | 59 | $tiles_manager = TilesManager::getInstance(); 60 | $tiles_manager->registerPluginTileType(new ConsumablesPageTile()); 61 | 62 | $CFG_GLPI['glpitablesitemtype'][Validation::class] = 'glpi_plugin_consumables_requests'; 63 | $PLUGIN_HOOKS['csrf_compliant']['consumables'] = true; 64 | $PLUGIN_HOOKS['change_profile']['consumables'] = [Profile::class, 'initProfile']; 65 | $PLUGIN_HOOKS[Hooks::ADD_CSS]['consumables'] = 'css/consumables.css'; 66 | $PLUGIN_HOOKS[Hooks::ADD_JAVASCRIPT]['consumables'] = 'js/consumables.js'; 67 | 68 | if (Session::getLoginUserID()) { 69 | $PLUGIN_HOOKS['post_item_form']['consumables'] = [Field::class, 'addFieldOrderReference']; 70 | 71 | Plugin::registerClass(Profile::class, ['addtabon' => 'Profile']); 72 | Plugin::registerClass(Request::class, ['addtabon' => 'User', 73 | 'notificationtemplates_types' => true]); 74 | Plugin::registerClass(Request::class, ['addtabon' => 'Group', 75 | 'notificationtemplates_types' => true]); 76 | Plugin::registerClass(Request::class, ['addtabon' => 'ConsumableItem']); 77 | 78 | $PLUGIN_HOOKS['item_add']['consumables'] = ['ConsumableItem' => [Field::class, 'postAddConsumable']]; 79 | $PLUGIN_HOOKS['pre_item_update']['consumables'] = ['ConsumableItem' => [Field::class, 'preUpdateConsumable']]; 80 | 81 | if (Session::haveRight("plugin_consumables", UPDATE)) { 82 | $PLUGIN_HOOKS['use_massive_action']['consumables'] = 1; 83 | } 84 | 85 | // if (class_exists(Main::class)) { 86 | $PLUGIN_HOOKS['servicecatalog']['consumables'] = [Servicecatalog::class]; 87 | // } 88 | 89 | if (Session::haveRight("plugin_consumables", READ)) { 90 | $PLUGIN_HOOKS['menu_toadd']['consumables'] = ['management' => Menu::class]; 91 | } 92 | if (Session::haveRight("plugin_consumables", READ) 93 | || Session::haveRight("plugin_consumables_request", 1) 94 | && !class_exists(Main::class)) { 95 | $PLUGIN_HOOKS['helpdesk_menu_entry']['consumables'] = PLUGIN_CONSUMABLES_WEBDIR . '/front/wizard.php'; 96 | $PLUGIN_HOOKS['helpdesk_menu_entry_icon']['consumables'] = Request::getIcon(); 97 | } 98 | 99 | // Post item purge 100 | $PLUGIN_HOOKS['item_purge']['consumables'] = ['ConsumableItem' => 'plugin_item_purge_consumables']; 101 | } 102 | } 103 | 104 | // Get the name and the version of the plugin - Needed 105 | 106 | /** 107 | * @return array 108 | */ 109 | function plugin_version_consumables() 110 | { 111 | 112 | return [ 113 | 'name' => _n('Consumable request', 'Consumable requests', 1, 'consumables'), 114 | 'version' => PLUGIN_CONSUMABLES_VERSION, 115 | 'author' => "Infotel, Xavier CAILLAUD", 116 | 'license' => 'GPLv2+', 117 | 'homepage' => 'https://github.com/InfotelGLPI/consumables', 118 | 'requirements' => [ 119 | 'glpi' => [ 120 | 'min' => '11.0', 121 | 'max' => '12.0', 122 | 'dev' => false, 123 | ], 124 | ], 125 | ]; 126 | } 127 | -------------------------------------------------------------------------------- /locales/en_GB.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) YEAR Consumables Development Team 2 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 3 | # 4 | # Translators: 5 | msgid "" 6 | msgstr "" 7 | "Project-Id-Version: GLPI Project - consumables plugin\n" 8 | "Report-Msgid-Bugs-To: \n" 9 | "POT-Creation-Date: 2020-07-21 11:49+0200\n" 10 | "PO-Revision-Date: 2020-07-21 09:58+0000\n" 11 | "Last-Translator: Xavier CAILLAUD \n" 12 | "Language-Team: English (United Kingdom) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/en_GB/)\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Language: en_GB\n" 17 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 | 19 | #: hook.php:166 inc/field.class.php:75 20 | msgid "Order reference" 21 | msgstr "Order reference" 22 | 23 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 24 | msgid "Maximum number allowed for request" 25 | msgstr "Maximum number allowed for request" 26 | 27 | #: hook.php:188 inc/option.class.php:133 28 | msgid "Allowed groups for request" 29 | msgstr "Allowed groups for request" 30 | 31 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 32 | msgid "Add a group for request" 33 | msgstr "Add a group for request" 34 | 35 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 36 | #: inc/notificationtargetrequest.class.php:51 37 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 38 | #: inc/request.class.php:390 inc/request.class.php:396 39 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 40 | #: inc/wizard.class.php:79 41 | msgid "Consumable request" 42 | msgid_plural "Consumable requests" 43 | msgstr[0] "Consumable request" 44 | msgstr[1] "Consumable requests" 45 | 46 | #: inc/notificationtargetrequest.class.php:52 47 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 48 | #: inc/profile.class.php:210 inc/validation.class.php:64 49 | #: inc/validation.class.php:91 inc/wizard.class.php:87 50 | msgid "Consumable validation" 51 | msgstr "Consumable validation" 52 | 53 | #: inc/notificationtargetrequest.class.php:63 54 | #: inc/notificationtargetrequest.class.php:109 55 | msgid "Consumable ID" 56 | msgstr "Consumable ID" 57 | 58 | #: inc/notificationtargetrequest.class.php:110 59 | msgid "Type of event" 60 | msgstr "Type of event" 61 | 62 | #: inc/notificationtargetrequest.class.php:130 63 | msgid "Display each consumable" 64 | msgstr "Display each consumable" 65 | 66 | #: inc/notificationtargetrequest.class.php:145 67 | msgid "Consumable approver" 68 | msgstr "Consumable approver" 69 | 70 | #: inc/notificationtargetrequest.class.php:146 71 | msgid "Consumable requester" 72 | msgstr "Consumable requester" 73 | 74 | #: inc/notificationtargetrequest.class.php:147 75 | msgid "Consumable recipient" 76 | msgstr "Consumable recipient" 77 | 78 | #: inc/option.class.php:51 79 | msgid "Consumable request options" 80 | msgstr "Consumable request options" 81 | 82 | #: inc/option.class.php:120 83 | msgctxt "button" 84 | msgid "Define" 85 | msgstr "Define" 86 | 87 | #: inc/profile.class.php:146 88 | msgid "Advanced" 89 | msgstr "Advanced" 90 | 91 | #: inc/profile.class.php:158 inc/profile.class.php:202 92 | #: inc/servicecatalog.class.php:81 93 | msgid "Make a consumable request" 94 | msgstr "Make a consumable request" 95 | 96 | #: inc/profile.class.php:166 97 | msgid "Make a consumable request for all users" 98 | msgstr "Make a consumable request for all users" 99 | 100 | #: inc/profile.class.php:171 101 | msgid "Make a consumable request for my groups" 102 | msgstr "Make a consumable request for my groups" 103 | 104 | #: inc/profile.class.php:191 105 | msgid "Consumable" 106 | msgid_plural "Consumables" 107 | msgstr[0] "Consumable" 108 | msgstr[1] "Consumables" 109 | 110 | #: inc/profile.class.php:198 111 | msgid "Make a consumable request for users" 112 | msgstr "Make a consumable request for users" 113 | 114 | #: inc/profile.class.php:206 115 | msgid "Make a consumable request for groups" 116 | msgstr "Make a consumable request for groups" 117 | 118 | #: inc/request.class.php:177 inc/request.class.php:326 119 | #: inc/request.class.php:362 120 | msgid "Consumable request report" 121 | msgstr "Consumable request report" 122 | 123 | #: inc/request.class.php:216 124 | msgid "Consumable requests history" 125 | msgstr "Consumable requests history" 126 | 127 | #: inc/request.class.php:248 128 | msgid "Consumables request search" 129 | msgstr "Consumables request search" 130 | 131 | #: inc/request.class.php:422 inc/request.class.php:467 132 | #: inc/request.class.php:830 inc/validation.class.php:129 133 | msgid "Number" 134 | msgstr "Number" 135 | 136 | #: inc/request.class.php:453 137 | msgid "Add to cart" 138 | msgstr "Add to cart" 139 | 140 | #: inc/request.class.php:462 141 | msgid "Cart" 142 | msgstr "Cart" 143 | 144 | #: inc/request.class.php:776 145 | msgid "Consumable affected" 146 | msgid_plural "Consumables affected" 147 | msgstr[0] "Consumable affected" 148 | msgstr[1] "Consumables affected" 149 | 150 | #: inc/request.class.php:793 151 | msgid "Please add consumables in cart" 152 | msgstr "Please add consumables in cart" 153 | 154 | #: inc/validation.class.php:255 155 | msgid "Refuse" 156 | msgstr "Refuse" 157 | 158 | #: inc/validation.class.php:350 159 | #, php-format 160 | msgid "Not enough stock for consumable %s" 161 | msgstr "Not enough stock for consumable %s" 162 | 163 | #: inc/wizard.class.php:52 164 | msgid "Consumables wizard" 165 | msgstr "Consumables wizard" 166 | -------------------------------------------------------------------------------- /locales/fi_FI.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Markku Vepsä, 2018 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI Project - consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 12 | "PO-Revision-Date: 2020-07-21 09:58+0000\n" 13 | "Last-Translator: Xavier CAILLAUD \n" 14 | "Language-Team: Finnish (Finland) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/fi_FI/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: fi_FI\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: hook.php:166 inc/field.class.php:75 22 | msgid "Order reference" 23 | msgstr "Tilauksen viite" 24 | 25 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 26 | msgid "Maximum number allowed for request" 27 | msgstr "Suurin sallittu määrä pyynnölle" 28 | 29 | #: hook.php:188 inc/option.class.php:133 30 | msgid "Allowed groups for request" 31 | msgstr "Sallitut ryhmät pyynnölle" 32 | 33 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 34 | msgid "Add a group for request" 35 | msgstr "Lisää ryhmä pyynnölle" 36 | 37 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 38 | #: inc/notificationtargetrequest.class.php:51 39 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 40 | #: inc/request.class.php:390 inc/request.class.php:396 41 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 42 | #: inc/wizard.class.php:79 43 | msgid "Consumable request" 44 | msgid_plural "Consumable requests" 45 | msgstr[0] "Kulutustarvike pyyntö" 46 | msgstr[1] "Kulutustarvike pyynnöt" 47 | 48 | #: inc/notificationtargetrequest.class.php:52 49 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 50 | #: inc/profile.class.php:210 inc/validation.class.php:64 51 | #: inc/validation.class.php:91 inc/wizard.class.php:87 52 | msgid "Consumable validation" 53 | msgstr "Kulutustarvike vahvistus" 54 | 55 | #: inc/notificationtargetrequest.class.php:63 56 | #: inc/notificationtargetrequest.class.php:109 57 | msgid "Consumable ID" 58 | msgstr "Kulutustarvike ID" 59 | 60 | #: inc/notificationtargetrequest.class.php:110 61 | msgid "Type of event" 62 | msgstr "Tapahtuman tyyppi" 63 | 64 | #: inc/notificationtargetrequest.class.php:130 65 | msgid "Display each consumable" 66 | msgstr "Näytä kaikki kulutustarvikkeet" 67 | 68 | #: inc/notificationtargetrequest.class.php:145 69 | msgid "Consumable approver" 70 | msgstr "Hyväksyjä" 71 | 72 | #: inc/notificationtargetrequest.class.php:146 73 | msgid "Consumable requester" 74 | msgstr "Toimeksiantaja" 75 | 76 | #: inc/notificationtargetrequest.class.php:147 77 | msgid "Consumable recipient" 78 | msgstr "" 79 | 80 | #: inc/option.class.php:51 81 | msgid "Consumable request options" 82 | msgstr "Kulutustarvikepyynnön vaihtoehdot" 83 | 84 | #: inc/option.class.php:120 85 | msgctxt "button" 86 | msgid "Define" 87 | msgstr "Määritä" 88 | 89 | #: inc/profile.class.php:146 90 | msgid "Advanced" 91 | msgstr "Lisäasetukset" 92 | 93 | #: inc/profile.class.php:158 inc/profile.class.php:202 94 | #: inc/servicecatalog.class.php:81 95 | msgid "Make a consumable request" 96 | msgstr "Tee kulutustarvikepyyntö" 97 | 98 | #: inc/profile.class.php:166 99 | msgid "Make a consumable request for all users" 100 | msgstr "Tee kulutustarvikepyyntö kaikille käyttäjille" 101 | 102 | #: inc/profile.class.php:171 103 | msgid "Make a consumable request for my groups" 104 | msgstr "Tee kulutustarvikepyyntö omille ryhmilleni" 105 | 106 | #: inc/profile.class.php:191 107 | msgid "Consumable" 108 | msgid_plural "Consumables" 109 | msgstr[0] "Kulutustarvike" 110 | msgstr[1] "Kulutustarvikkeet" 111 | 112 | #: inc/profile.class.php:198 113 | msgid "Make a consumable request for users" 114 | msgstr "Tee kulutustarvikepyyntö käyttäjille" 115 | 116 | #: inc/profile.class.php:206 117 | msgid "Make a consumable request for groups" 118 | msgstr "Tee kulutustarvikepyyntö ryhmille" 119 | 120 | #: inc/request.class.php:177 inc/request.class.php:326 121 | #: inc/request.class.php:362 122 | msgid "Consumable request report" 123 | msgstr "Kulutustarvikepyyntö raportti" 124 | 125 | #: inc/request.class.php:216 126 | msgid "Consumable requests history" 127 | msgstr "Kulutustarvikepyyntö historia" 128 | 129 | #: inc/request.class.php:248 130 | msgid "Consumables request search" 131 | msgstr "Kulutustarvikepyyntö haku" 132 | 133 | #: inc/request.class.php:422 inc/request.class.php:467 134 | #: inc/request.class.php:830 inc/validation.class.php:129 135 | msgid "Number" 136 | msgstr "Määrä" 137 | 138 | #: inc/request.class.php:453 139 | msgid "Add to cart" 140 | msgstr "Lisää koriin" 141 | 142 | #: inc/request.class.php:462 143 | msgid "Cart" 144 | msgstr "Kori" 145 | 146 | #: inc/request.class.php:776 147 | msgid "Consumable affected" 148 | msgid_plural "Consumables affected" 149 | msgstr[0] "Vaikutus kulutustarvikkeeseen" 150 | msgstr[1] "Vaikutus kulutustarvikkeisiin" 151 | 152 | #: inc/request.class.php:793 153 | msgid "Please add consumables in cart" 154 | msgstr "Lisää kulutustarvikkeita koriin" 155 | 156 | #: inc/validation.class.php:255 157 | msgid "Refuse" 158 | msgstr "Hylkää" 159 | 160 | #: inc/validation.class.php:350 161 | #, php-format 162 | msgid "Not enough stock for consumable %s" 163 | msgstr "Ei tarpeeksi varastoa kulutustarvikkeelle %s" 164 | 165 | #: inc/wizard.class.php:52 166 | msgid "Consumables wizard" 167 | msgstr "Kulutustarvikkeiden ohjattu toiminto" 168 | -------------------------------------------------------------------------------- /src/Helpdesk/Tile/ConsumablesPageTile.php: -------------------------------------------------------------------------------- 1 | . 31 | * 32 | * --------------------------------------------------------------------- 33 | */ 34 | 35 | namespace GlpiPlugin\Consumables\Helpdesk\Tile; 36 | 37 | use CommonDBTM; 38 | use Glpi\Helpdesk\HelpdeskTranslation; 39 | use Glpi\Helpdesk\Tile\Item_Tile; 40 | use Glpi\Helpdesk\Tile\TileInterface; 41 | use Glpi\ItemTranslation\Context\ProvideTranslationsInterface; 42 | use Glpi\ItemTranslation\Context\TranslationHandler; 43 | use Glpi\Session\SessionInfo; 44 | use Glpi\UI\IllustrationManager; 45 | use Html; 46 | use Override; 47 | use Session; 48 | 49 | final class ConsumablesPageTile extends CommonDBTM implements TileInterface, ProvideTranslationsInterface 50 | { 51 | public static $rightname = 'config'; 52 | 53 | public const PAGE_CONSUMABLE_REQUEST = 'consumables'; 54 | 55 | public const TRANSLATION_KEY_TITLE = 'title'; 56 | public const TRANSLATION_KEY_DESCRIPTION = 'description'; 57 | 58 | #[Override] 59 | public function getWeight(): int 60 | { 61 | return 20; 62 | } 63 | 64 | #[Override] 65 | public function getLabel(): string 66 | { 67 | return _n('Consumable request', 'Consumable requests', 1, 'consumables'); 68 | } 69 | 70 | #[Override] 71 | public static function canCreate(): bool 72 | { 73 | return self::canUpdate(); 74 | } 75 | 76 | #[Override] 77 | public static function canPurge(): bool 78 | { 79 | return self::canUpdate(); 80 | } 81 | 82 | public static function getPossiblesPages(): array 83 | { 84 | return [ 85 | self::PAGE_CONSUMABLE_REQUEST => _n('Consumable request', 'Consumable requests', 1, 'consumables'), 86 | ]; 87 | } 88 | 89 | #[Override] 90 | public function getTitle(): string 91 | { 92 | return $this->fields['title'] ?? ""; 93 | } 94 | 95 | #[Override] 96 | public function getDescription(): string 97 | { 98 | return $this->fields['description'] ?? ""; 99 | } 100 | 101 | #[Override] 102 | public function getIllustration(): string 103 | { 104 | return $this->fields['illustration'] ?? IllustrationManager::DEFAULT_ILLUSTRATION; 105 | } 106 | 107 | #[Override] 108 | public function getTileUrl(): string 109 | { 110 | $url = PLUGIN_CONSUMABLES_WEBDIR . '/front/wizard.form.php?action=consumablerequest'; 111 | return Html::getPrefixedUrl($url); 112 | } 113 | 114 | #[Override] 115 | public function isAvailable(SessionInfo $session_info): bool 116 | { 117 | return Session::haveRight("plugin_consumables_request", 1); 118 | } 119 | 120 | #[Override] 121 | public function getDatabaseId(): int 122 | { 123 | return $this->fields['id']; 124 | } 125 | 126 | #[Override] 127 | public function getConfigFieldsTemplate(): string 128 | { 129 | return "pages/admin/glpi_page_tile_config_fields.html.twig"; 130 | } 131 | 132 | #[Override] 133 | public function cleanDBonPurge() 134 | { 135 | $this->deleteChildrenAndRelationsFromDb( 136 | [ 137 | Item_Tile::class, 138 | HelpdeskTranslation::class, 139 | ] 140 | ); 141 | } 142 | 143 | #[Override] 144 | public function listTranslationsHandlers(): array 145 | { 146 | $handlers = []; 147 | $key = sprintf('%s_%d', self::getType(), $this->getID()); 148 | $category_name = sprintf('%s: %s', $this->getLabel(), $this->fields['title'] ?? NOT_AVAILABLE); 149 | if (!empty($this->getTitle())) { 150 | $handlers[$key][] = new TranslationHandler( 151 | item: $this, 152 | key: self::TRANSLATION_KEY_TITLE, 153 | name: __('Title'), 154 | value: $this->getTitle(), 155 | is_rich_text: false, 156 | category: $category_name 157 | ); 158 | } 159 | if (!empty($this->getDescription())) { 160 | $handlers[$key][] = new TranslationHandler( 161 | item: $this, 162 | key: self::TRANSLATION_KEY_DESCRIPTION, 163 | name: __('Description'), 164 | value: $this->getDescription(), 165 | is_rich_text: true, 166 | category: $category_name 167 | ); 168 | } 169 | 170 | return $handlers; 171 | } 172 | 173 | public function getPage(): string 174 | { 175 | return $this->fields['page'] ?? ""; 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /locales/es_419.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Emiliano Cagliari , 2017 7 | # Enrique Corujo, 2021 8 | # Fernando Abramowitz , 2016 9 | # Emiliano Cagliari , 2016 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: GLPI Project - consumables plugin\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2021-11-14 16:08+0000\n" 15 | "PO-Revision-Date: 2021-11-18 11:23+0000\n" 16 | "Last-Translator: Enrique Corujo\n" 17 | "Language-Team: Spanish (Latin America) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/es_419/)\n" 18 | "MIME-Version: 1.0\n" 19 | "Content-Type: text/plain; charset=UTF-8\n" 20 | "Content-Transfer-Encoding: 8bit\n" 21 | "Language: es_419\n" 22 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 23 | 24 | #: hook.php:166 inc/field.class.php:75 25 | msgid "Order reference" 26 | msgstr "Referencia del pedido" 27 | 28 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:306 29 | msgid "Maximum number allowed for request" 30 | msgstr "Cantidad máxima permitida por pedido" 31 | 32 | #: hook.php:188 inc/option.class.php:132 33 | msgid "Allowed groups for request" 34 | msgstr "Grupos habilitados para pedidos" 35 | 36 | #: hook.php:210 inc/option.class.php:183 inc/option.class.php:316 37 | msgid "Add a group for request" 38 | msgstr "Agregar al grupo para pedidos" 39 | 40 | #: setup.php:83 inc/field.class.php:54 inc/menu.class.php:41 41 | #: inc/notificationtargetrequest.class.php:51 42 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 43 | #: inc/request.class.php:417 inc/request.class.php:423 44 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:69 45 | #: inc/wizard.class.php:84 46 | msgid "Consumable request" 47 | msgid_plural "Consumable requests" 48 | msgstr[0] "Pedido de insumo" 49 | msgstr[1] "Pedido de insumos" 50 | 51 | #: front/wizard.form.php:56 inc/notificationtargetrequest.class.php:52 52 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 53 | #: inc/profile.class.php:210 inc/validation.class.php:139 54 | #: inc/validation.class.php:166 inc/wizard.class.php:92 55 | msgid "Consumable validation" 56 | msgstr "Aprobación de insumo" 57 | 58 | #: inc/notificationtargetrequest.class.php:63 59 | #: inc/notificationtargetrequest.class.php:120 60 | msgid "Consumable ID" 61 | msgstr "ID de Insumo" 62 | 63 | #: inc/notificationtargetrequest.class.php:121 64 | msgid "Type of event" 65 | msgstr "Tipo de evento" 66 | 67 | #: inc/notificationtargetrequest.class.php:142 68 | msgid "Display each consumable" 69 | msgstr "Mostrar cada insumo" 70 | 71 | #: inc/notificationtargetrequest.class.php:157 72 | msgid "Consumable approver" 73 | msgstr "Aprobador de Insumo" 74 | 75 | #: inc/notificationtargetrequest.class.php:158 76 | msgid "Consumable requester" 77 | msgstr "Solicitante de insumo" 78 | 79 | #: inc/notificationtargetrequest.class.php:159 80 | msgid "Consumable recipient" 81 | msgstr "Contendor de insumo" 82 | 83 | #: inc/option.class.php:51 84 | msgid "Consumable request options" 85 | msgstr "Opciones del pedido de insumos" 86 | 87 | #: inc/option.class.php:119 88 | msgctxt "button" 89 | msgid "Define" 90 | msgstr "Definir" 91 | 92 | #: inc/profile.class.php:146 93 | msgid "Advanced" 94 | msgstr "Avanzado" 95 | 96 | #: inc/profile.class.php:158 inc/profile.class.php:202 97 | #: inc/servicecatalog.class.php:81 98 | msgid "Make a consumable request" 99 | msgstr "Crear un pedido de insumos" 100 | 101 | #: inc/profile.class.php:166 102 | msgid "Make a consumable request for all users" 103 | msgstr "Crear un pedido de insumos para todos los usuarios" 104 | 105 | #: inc/profile.class.php:171 106 | msgid "Make a consumable request for my groups" 107 | msgstr "Crear un pedido de insumos para mis grupos" 108 | 109 | #: inc/profile.class.php:191 110 | msgid "Consumable" 111 | msgid_plural "Consumables" 112 | msgstr[0] "Insumo" 113 | msgstr[1] "Insumos" 114 | 115 | #: inc/profile.class.php:198 116 | msgid "Make a consumable request for users" 117 | msgstr "Crear un pedido de insumos para usuarios" 118 | 119 | #: inc/profile.class.php:206 120 | msgid "Make a consumable request for groups" 121 | msgstr "Crear un pedido de insumos para grupos" 122 | 123 | #: inc/request.class.php:198 inc/request.class.php:352 124 | #: inc/request.class.php:388 125 | msgid "Consumable request report" 126 | msgstr "Reporte de pedidos de insumos" 127 | 128 | #: inc/request.class.php:237 129 | msgid "Consumable requests history" 130 | msgstr "Historial de pedidos de insumos" 131 | 132 | #: inc/request.class.php:269 133 | msgid "Consumables request search" 134 | msgstr "Búsqueda de pedidos de insumos" 135 | 136 | #: inc/request.class.php:449 inc/request.class.php:494 137 | #: inc/request.class.php:868 inc/validation.class.php:98 138 | #: inc/validation.class.php:204 139 | msgid "Number" 140 | msgstr "Número" 141 | 142 | #: inc/request.class.php:480 143 | msgid "Add to cart" 144 | msgstr "Agregar al carro" 145 | 146 | #: inc/request.class.php:489 147 | msgid "Cart" 148 | msgstr "Carro" 149 | 150 | #: inc/request.class.php:814 151 | msgid "Consumable affected" 152 | msgid_plural "Consumables affected" 153 | msgstr[0] "Insumo solicitado" 154 | msgstr[1] "Insumos solicitados" 155 | 156 | #: inc/request.class.php:831 157 | msgid "Please add consumables in cart" 158 | msgstr "Por favor agregue insumos en el carro" 159 | 160 | #: inc/validation.class.php:334 161 | msgid "Refuse" 162 | msgstr "Rechazar" 163 | 164 | #: inc/validation.class.php:429 165 | #, php-format 166 | msgid "Not enough stock for consumable %s" 167 | msgstr "No hay suficiente stock del insumo %s" 168 | 169 | #: inc/wizard.class.php:52 170 | msgid "Consumables wizard" 171 | msgstr "Asistente de insumos" 172 | -------------------------------------------------------------------------------- /locales/es_ES.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # FranciscoFJ , 2018-2019,2021 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI Project - consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2021-02-27 12:39+0000\n" 12 | "PO-Revision-Date: 2021-03-11 09:34+0000\n" 13 | "Last-Translator: FranciscoFJ \n" 14 | "Language-Team: Spanish (Spain) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/es_ES/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: es_ES\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: hook.php:166 inc/field.class.php:75 22 | msgid "Order reference" 23 | msgstr "Referencia de la orden" 24 | 25 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 26 | msgid "Maximum number allowed for request" 27 | msgstr "Cantidad máxima permitida para la solicitud" 28 | 29 | #: hook.php:188 inc/option.class.php:133 30 | msgid "Allowed groups for request" 31 | msgstr "Grupos permitidos para solicitar" 32 | 33 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 34 | msgid "Add a group for request" 35 | msgstr "Agregar un grupo para solicitar" 36 | 37 | #: setup.php:83 inc/field.class.php:54 inc/menu.class.php:41 38 | #: inc/notificationtargetrequest.class.php:51 39 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 40 | #: inc/request.class.php:412 inc/request.class.php:418 41 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 42 | #: inc/wizard.class.php:79 43 | msgid "Consumable request" 44 | msgid_plural "Consumable requests" 45 | msgstr[0] "Solicitud de consumible" 46 | msgstr[1] "Solicitudes de consumibles" 47 | 48 | #: inc/notificationtargetrequest.class.php:52 49 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 50 | #: inc/profile.class.php:210 inc/validation.class.php:139 51 | #: inc/validation.class.php:166 inc/wizard.class.php:87 52 | msgid "Consumable validation" 53 | msgstr "Validación de consumibles" 54 | 55 | #: inc/notificationtargetrequest.class.php:63 56 | #: inc/notificationtargetrequest.class.php:120 57 | msgid "Consumable ID" 58 | msgstr "ID de consumible" 59 | 60 | #: inc/notificationtargetrequest.class.php:121 61 | msgid "Type of event" 62 | msgstr "Tipo de evento" 63 | 64 | #: inc/notificationtargetrequest.class.php:142 65 | msgid "Display each consumable" 66 | msgstr "Muestra cada consumible" 67 | 68 | #: inc/notificationtargetrequest.class.php:157 69 | msgid "Consumable approver" 70 | msgstr "Responsable de validación" 71 | 72 | #: inc/notificationtargetrequest.class.php:158 73 | msgid "Consumable requester" 74 | msgstr "Solicitante de consumibles" 75 | 76 | #: inc/notificationtargetrequest.class.php:159 77 | msgid "Consumable recipient" 78 | msgstr "Destinatario del consumible" 79 | 80 | #: inc/option.class.php:51 81 | msgid "Consumable request options" 82 | msgstr "Opciones de solicitud de consumibles" 83 | 84 | #: inc/option.class.php:120 85 | msgctxt "button" 86 | msgid "Define" 87 | msgstr "Define" 88 | 89 | #: inc/profile.class.php:146 90 | msgid "Advanced" 91 | msgstr "Avanzado" 92 | 93 | #: inc/profile.class.php:158 inc/profile.class.php:202 94 | #: inc/servicecatalog.class.php:81 95 | msgid "Make a consumable request" 96 | msgstr "Hacer una solicitud de consumibles" 97 | 98 | #: inc/profile.class.php:166 99 | msgid "Make a consumable request for all users" 100 | msgstr "Hacer una solicitud de consumibles para todos los usuarios" 101 | 102 | #: inc/profile.class.php:171 103 | msgid "Make a consumable request for my groups" 104 | msgstr "Hacer una solicitud de consumibles para mis grupos" 105 | 106 | #: inc/profile.class.php:191 107 | msgid "Consumable" 108 | msgid_plural "Consumables" 109 | msgstr[0] "Consumible" 110 | msgstr[1] "Consumibles" 111 | 112 | #: inc/profile.class.php:198 113 | msgid "Make a consumable request for users" 114 | msgstr "Hacer una solicitud de consumibles para los usuarios" 115 | 116 | #: inc/profile.class.php:206 117 | msgid "Make a consumable request for groups" 118 | msgstr "Hacer una solicitud de consumibles para los grupos" 119 | 120 | #: inc/request.class.php:198 inc/request.class.php:348 121 | #: inc/request.class.php:384 122 | msgid "Consumable request report" 123 | msgstr "Informe de solicitud de consumibles" 124 | 125 | #: inc/request.class.php:237 126 | msgid "Consumable requests history" 127 | msgstr "Historial de solicitudes de consumibles" 128 | 129 | #: inc/request.class.php:269 130 | msgid "Consumables request search" 131 | msgstr "Búsqueda de solicitud de consumibles" 132 | 133 | #: inc/request.class.php:444 inc/request.class.php:489 134 | #: inc/request.class.php:861 inc/validation.class.php:98 135 | #: inc/validation.class.php:204 136 | msgid "Number" 137 | msgstr "Cantidad" 138 | 139 | #: inc/request.class.php:475 140 | msgid "Add to cart" 141 | msgstr "Añadir a la cesta" 142 | 143 | #: inc/request.class.php:484 144 | msgid "Cart" 145 | msgstr "Cesta" 146 | 147 | #: inc/request.class.php:807 148 | msgid "Consumable affected" 149 | msgid_plural "Consumables affected" 150 | msgstr[0] "Consumible afectado" 151 | msgstr[1] "Consumibles afectados" 152 | 153 | #: inc/request.class.php:824 154 | msgid "Please add consumables in cart" 155 | msgstr "Por favor agrega los consumibles en la cesta" 156 | 157 | #: inc/validation.class.php:330 158 | msgid "Refuse" 159 | msgstr "Denegar" 160 | 161 | #: inc/validation.class.php:425 162 | #, php-format 163 | msgid "Not enough stock for consumable %s" 164 | msgstr "No hay suficientes existencias de %s" 165 | 166 | #: inc/wizard.class.php:52 167 | msgid "Consumables wizard" 168 | msgstr "Asistente de consumibles" 169 | -------------------------------------------------------------------------------- /locales/pt_PT.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Emperium , 2018 7 | # Emperium , 2019 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: GLPI Project - consumables plugin\n" 11 | "Report-Msgid-Bugs-To: \n" 12 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 13 | "PO-Revision-Date: 2020-07-21 09:58+0000\n" 14 | "Last-Translator: Xavier CAILLAUD \n" 15 | "Language-Team: Portuguese (Portugal) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/pt_PT/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: pt_PT\n" 20 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 21 | 22 | #: hook.php:166 inc/field.class.php:75 23 | msgid "Order reference" 24 | msgstr "Referencia da encomenda " 25 | 26 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 27 | msgid "Maximum number allowed for request" 28 | msgstr "Numero máximo permitido por requisição " 29 | 30 | #: hook.php:188 inc/option.class.php:133 31 | msgid "Allowed groups for request" 32 | msgstr "Grupos autorizados a fazer requisição" 33 | 34 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 35 | msgid "Add a group for request" 36 | msgstr "Adicionar um grupo para requisição" 37 | 38 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 39 | #: inc/notificationtargetrequest.class.php:51 40 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 41 | #: inc/request.class.php:390 inc/request.class.php:396 42 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 43 | #: inc/wizard.class.php:79 44 | msgid "Consumable request" 45 | msgid_plural "Consumable requests" 46 | msgstr[0] "Pedido de consumíveis" 47 | msgstr[1] "Pedidos de consumíveis" 48 | 49 | #: inc/notificationtargetrequest.class.php:52 50 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 51 | #: inc/profile.class.php:210 inc/validation.class.php:64 52 | #: inc/validation.class.php:91 inc/wizard.class.php:87 53 | msgid "Consumable validation" 54 | msgstr "Validação do consumível " 55 | 56 | #: inc/notificationtargetrequest.class.php:63 57 | #: inc/notificationtargetrequest.class.php:109 58 | msgid "Consumable ID" 59 | msgstr "ID do consumível " 60 | 61 | #: inc/notificationtargetrequest.class.php:110 62 | msgid "Type of event" 63 | msgstr "Tipo de evento" 64 | 65 | #: inc/notificationtargetrequest.class.php:130 66 | msgid "Display each consumable" 67 | msgstr "Mostra cada consumível " 68 | 69 | #: inc/notificationtargetrequest.class.php:145 70 | msgid "Consumable approver" 71 | msgstr "Consumível aprovado " 72 | 73 | #: inc/notificationtargetrequest.class.php:146 74 | msgid "Consumable requester" 75 | msgstr "Requerente de consumível" 76 | 77 | #: inc/notificationtargetrequest.class.php:147 78 | msgid "Consumable recipient" 79 | msgstr "" 80 | 81 | #: inc/option.class.php:51 82 | msgid "Consumable request options" 83 | msgstr "Opções de requisição de consumíveis " 84 | 85 | #: inc/option.class.php:120 86 | msgctxt "button" 87 | msgid "Define" 88 | msgstr "Defina " 89 | 90 | #: inc/profile.class.php:146 91 | msgid "Advanced" 92 | msgstr "Avançado " 93 | 94 | #: inc/profile.class.php:158 inc/profile.class.php:202 95 | #: inc/servicecatalog.class.php:81 96 | msgid "Make a consumable request" 97 | msgstr "Fazer uma requisição de consumível " 98 | 99 | #: inc/profile.class.php:166 100 | msgid "Make a consumable request for all users" 101 | msgstr "Criar uma requisição de consumível para todos os utilizadores" 102 | 103 | #: inc/profile.class.php:171 104 | msgid "Make a consumable request for my groups" 105 | msgstr "Criar uma requisição de consumível para os meus grupos" 106 | 107 | #: inc/profile.class.php:191 108 | msgid "Consumable" 109 | msgid_plural "Consumables" 110 | msgstr[0] "Consumível " 111 | msgstr[1] "Consumíveis " 112 | 113 | #: inc/profile.class.php:198 114 | msgid "Make a consumable request for users" 115 | msgstr "Criar uma requisição de consumível para os utilizadores" 116 | 117 | #: inc/profile.class.php:206 118 | msgid "Make a consumable request for groups" 119 | msgstr "Criar uma requisição de consumível para grupos" 120 | 121 | #: inc/request.class.php:177 inc/request.class.php:326 122 | #: inc/request.class.php:362 123 | msgid "Consumable request report" 124 | msgstr "Relatório de requisição de consumível " 125 | 126 | #: inc/request.class.php:216 127 | msgid "Consumable requests history" 128 | msgstr "Histórico de requisições de consumível" 129 | 130 | #: inc/request.class.php:248 131 | msgid "Consumables request search" 132 | msgstr "Pesquisa de requisições de consumíveis " 133 | 134 | #: inc/request.class.php:422 inc/request.class.php:467 135 | #: inc/request.class.php:830 inc/validation.class.php:129 136 | msgid "Number" 137 | msgstr "Número " 138 | 139 | #: inc/request.class.php:453 140 | msgid "Add to cart" 141 | msgstr "Adicionar ao carrinho " 142 | 143 | #: inc/request.class.php:462 144 | msgid "Cart" 145 | msgstr "Carrinho" 146 | 147 | #: inc/request.class.php:776 148 | msgid "Consumable affected" 149 | msgid_plural "Consumables affected" 150 | msgstr[0] "Consumível afectado" 151 | msgstr[1] "Consumíveis afectados " 152 | 153 | #: inc/request.class.php:793 154 | msgid "Please add consumables in cart" 155 | msgstr "Por favor adicione consumíveis ao carrinho " 156 | 157 | #: inc/validation.class.php:255 158 | msgid "Refuse" 159 | msgstr "Recusado " 160 | 161 | #: inc/validation.class.php:350 162 | #, php-format 163 | msgid "Not enough stock for consumable %s" 164 | msgstr "Sem stock suficiente para o consumível %s" 165 | 166 | #: inc/wizard.class.php:52 167 | msgid "Consumables wizard" 168 | msgstr "Assistente de consumíveis " 169 | -------------------------------------------------------------------------------- /locales/pt_BR.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Flávio Caetano , 2018 7 | # Rodrigo de Almeida Sottomaior Macedo , 2020 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: GLPI Project - consumables plugin\n" 11 | "Report-Msgid-Bugs-To: \n" 12 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 13 | "PO-Revision-Date: 2020-07-27 18:16+0000\n" 14 | "Last-Translator: Rodrigo de Almeida Sottomaior Macedo \n" 15 | "Language-Team: Portuguese (Brazil) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/pt_BR/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: pt_BR\n" 20 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 21 | 22 | #: hook.php:166 inc/field.class.php:75 23 | msgid "Order reference" 24 | msgstr "Referência de encomenda" 25 | 26 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 27 | msgid "Maximum number allowed for request" 28 | msgstr "Número máximo permitido para solicitação" 29 | 30 | #: hook.php:188 inc/option.class.php:133 31 | msgid "Allowed groups for request" 32 | msgstr "Grupos permitidos para solicitação" 33 | 34 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 35 | msgid "Add a group for request" 36 | msgstr "Adicione um grupo para solicitação" 37 | 38 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 39 | #: inc/notificationtargetrequest.class.php:51 40 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 41 | #: inc/request.class.php:390 inc/request.class.php:396 42 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 43 | #: inc/wizard.class.php:79 44 | msgid "Consumable request" 45 | msgid_plural "Consumable requests" 46 | msgstr[0] "Pedidos de consumíveis" 47 | msgstr[1] "Consumable requests" 48 | 49 | #: inc/notificationtargetrequest.class.php:52 50 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 51 | #: inc/profile.class.php:210 inc/validation.class.php:64 52 | #: inc/validation.class.php:91 inc/wizard.class.php:87 53 | msgid "Consumable validation" 54 | msgstr "Validação de consumíveis" 55 | 56 | #: inc/notificationtargetrequest.class.php:63 57 | #: inc/notificationtargetrequest.class.php:109 58 | msgid "Consumable ID" 59 | msgstr "ID de consumíveis" 60 | 61 | #: inc/notificationtargetrequest.class.php:110 62 | msgid "Type of event" 63 | msgstr "Tipo de evento" 64 | 65 | #: inc/notificationtargetrequest.class.php:130 66 | msgid "Display each consumable" 67 | msgstr "Exibir cada consumível" 68 | 69 | #: inc/notificationtargetrequest.class.php:145 70 | msgid "Consumable approver" 71 | msgstr "Aprovador de consumíveis" 72 | 73 | #: inc/notificationtargetrequest.class.php:146 74 | msgid "Consumable requester" 75 | msgstr "Solicitador de consumíveis" 76 | 77 | #: inc/notificationtargetrequest.class.php:147 78 | msgid "Consumable recipient" 79 | msgstr "Destinatário consumível" 80 | 81 | #: inc/option.class.php:51 82 | msgid "Consumable request options" 83 | msgstr "Opções de solicitação de consumíveis" 84 | 85 | #: inc/option.class.php:120 86 | msgctxt "button" 87 | msgid "Define" 88 | msgstr "Define" 89 | 90 | #: inc/profile.class.php:146 91 | msgid "Advanced" 92 | msgstr "Avançado" 93 | 94 | #: inc/profile.class.php:158 inc/profile.class.php:202 95 | #: inc/servicecatalog.class.php:81 96 | msgid "Make a consumable request" 97 | msgstr "Fazer um pedido de consumível" 98 | 99 | #: inc/profile.class.php:166 100 | msgid "Make a consumable request for all users" 101 | msgstr "Fazer um pedido de consumo para todos os usuários" 102 | 103 | #: inc/profile.class.php:171 104 | msgid "Make a consumable request for my groups" 105 | msgstr "Fazer um pedido de consumíveis para meus grupos" 106 | 107 | #: inc/profile.class.php:191 108 | msgid "Consumable" 109 | msgid_plural "Consumables" 110 | msgstr[0] "Consumível" 111 | msgstr[1] "Consumível" 112 | 113 | #: inc/profile.class.php:198 114 | msgid "Make a consumable request for users" 115 | msgstr "Fazer um pedido de consumíveis para usuários" 116 | 117 | #: inc/profile.class.php:206 118 | msgid "Make a consumable request for groups" 119 | msgstr "Fazer um pedido de consumíveis para grupos" 120 | 121 | #: inc/request.class.php:177 inc/request.class.php:326 122 | #: inc/request.class.php:362 123 | msgid "Consumable request report" 124 | msgstr "Relatório de pedido de consumíveis" 125 | 126 | #: inc/request.class.php:216 127 | msgid "Consumable requests history" 128 | msgstr "Histórico de pedidos de consumíveis" 129 | 130 | #: inc/request.class.php:248 131 | msgid "Consumables request search" 132 | msgstr "Pesquisa de pedidos de consumíveis" 133 | 134 | #: inc/request.class.php:422 inc/request.class.php:467 135 | #: inc/request.class.php:830 inc/validation.class.php:129 136 | msgid "Number" 137 | msgstr "Número" 138 | 139 | #: inc/request.class.php:453 140 | msgid "Add to cart" 141 | msgstr "Adicionar ao carrinho" 142 | 143 | #: inc/request.class.php:462 144 | msgid "Cart" 145 | msgstr "Carrinho" 146 | 147 | #: inc/request.class.php:776 148 | msgid "Consumable affected" 149 | msgid_plural "Consumables affected" 150 | msgstr[0] "Consumíveis afetados" 151 | msgstr[1] "Consumíveis afetados" 152 | 153 | #: inc/request.class.php:793 154 | msgid "Please add consumables in cart" 155 | msgstr "Por favor, adicione consumíveis no carrinho" 156 | 157 | #: inc/validation.class.php:255 158 | msgid "Refuse" 159 | msgstr "Recusar" 160 | 161 | #: inc/validation.class.php:350 162 | #, php-format 163 | msgid "Not enough stock for consumable %s" 164 | msgstr "Estoque insuficiente para consumíveis%s" 165 | 166 | #: inc/wizard.class.php:52 167 | msgid "Consumables wizard" 168 | msgstr "Assistente de consumíveis" 169 | -------------------------------------------------------------------------------- /locales/de_DE.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Michael Schieferer, 2022 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI Project - consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2022-07-26 13:54+0000\n" 12 | "PO-Revision-Date: 2015-09-17 11:45+0000\n" 13 | "Last-Translator: Michael Schieferer, 2022\n" 14 | "Language-Team: German (Germany) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/de_DE/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: de_DE\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: hook.php:165 inc/field.class.php:75 22 | msgid "Order reference" 23 | msgstr "Bestellreferenz" 24 | 25 | #: hook.php:175 hook.php:207 inc/option.class.php:111 inc/option.class.php:306 26 | msgid "Maximum number allowed for request" 27 | msgstr "Maximal erlaubte Anzahl pro Anfrage" 28 | 29 | #: hook.php:187 inc/option.class.php:132 30 | msgid "Allowed groups for request" 31 | msgstr "Berechtigte Gruppe für Anfrage" 32 | 33 | #: hook.php:209 inc/option.class.php:183 inc/option.class.php:316 34 | msgid "Add a group for request" 35 | msgstr "Gruppe dieser Anfrage hinzufügen" 36 | 37 | #: setup.php:94 inc/field.class.php:54 inc/menu.class.php:41 38 | #: inc/notificationtargetrequest.class.php:51 39 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 40 | #: inc/request.class.php:421 inc/request.class.php:428 41 | #: inc/servicecatalog.class.php:73 inc/wizard.class.php:69 42 | #: inc/wizard.class.php:78 43 | msgid "Consumable request" 44 | msgid_plural "Consumable requests" 45 | msgstr[0] "Anfrage für Verbrauchsmaterial" 46 | msgstr[1] "Anfragen für Verbrauchsmaterialien" 47 | 48 | #: front/wizard.form.php:53 inc/notificationtargetrequest.class.php:52 49 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:151 50 | #: inc/profile.class.php:213 inc/validation.class.php:139 51 | #: inc/validation.class.php:166 inc/wizard.class.php:86 52 | msgid "Consumable validation" 53 | msgstr "Verbrauchsmaterial bestätigen" 54 | 55 | #: inc/notificationtargetrequest.class.php:63 56 | #: inc/notificationtargetrequest.class.php:120 57 | msgid "Consumable ID" 58 | msgstr "Verbrauchsmaterial ID" 59 | 60 | #: inc/notificationtargetrequest.class.php:121 61 | msgid "Type of event" 62 | msgstr "Art der Ereignisses" 63 | 64 | #: inc/notificationtargetrequest.class.php:142 65 | msgid "Display each consumable" 66 | msgstr "Jedes Verbrauchsmaterial anzeigen" 67 | 68 | #: inc/notificationtargetrequest.class.php:157 69 | msgid "Consumable approver" 70 | msgstr "Genehmiger für Verbrauchsmaterial" 71 | 72 | #: inc/notificationtargetrequest.class.php:158 73 | msgid "Consumable requester" 74 | msgstr "Anfragesteller für Verbrauchsmaterial" 75 | 76 | #: inc/notificationtargetrequest.class.php:159 77 | msgid "Consumable recipient" 78 | msgstr "Empfänger des Verbrauchsmaterials" 79 | 80 | #: inc/option.class.php:51 81 | msgid "Consumable request options" 82 | msgstr "Anfrageoptionen Verbrauchsmaterial" 83 | 84 | #: inc/option.class.php:119 85 | msgctxt "button" 86 | msgid "Define" 87 | msgstr "Definieren" 88 | 89 | #: inc/profile.class.php:143 90 | msgid "Advanced" 91 | msgstr "Erweitert" 92 | 93 | #: inc/profile.class.php:155 inc/profile.class.php:205 94 | #: inc/servicecatalog.class.php:100 95 | msgid "Make a consumable request" 96 | msgstr "Anfrage für Verbrauchsmaterial einreichen" 97 | 98 | #: inc/profile.class.php:163 99 | msgid "Make a consumable request for all users" 100 | msgstr "Verbrauchsmaterial-Anfrage für alle Benutzer einreichen" 101 | 102 | #: inc/profile.class.php:168 103 | msgid "Make a consumable request for my groups" 104 | msgstr "Verbrauchsmaterial-Anfrage für meine Gruppe einreichen" 105 | 106 | #: inc/profile.class.php:194 107 | msgid "Consumable" 108 | msgid_plural "Consumables" 109 | msgstr[0] "Verbrauchsmaterial" 110 | msgstr[1] "Verbrauchsmaterialen" 111 | 112 | #: inc/profile.class.php:201 113 | msgid "Make a consumable request for users" 114 | msgstr "Verbrauchsmaterial-Anfrage für Benutzer einreichen" 115 | 116 | #: inc/profile.class.php:209 117 | msgid "Make a consumable request for groups" 118 | msgstr "Verbrauchsmaterial-Anfrage für Gruppen einreichen" 119 | 120 | #: inc/request.class.php:202 inc/request.class.php:356 121 | #: inc/request.class.php:392 122 | msgid "Consumable request report" 123 | msgstr "Bericht zu Verbrauchsmaterialanfragen" 124 | 125 | #: inc/request.class.php:241 126 | msgid "Consumable requests history" 127 | msgstr "Verlauf der Verbrauchsmaterialanfragen" 128 | 129 | #: inc/request.class.php:273 130 | msgid "Consumables request search" 131 | msgstr "Verbrauchsmaterialanfragen suchen" 132 | 133 | #: inc/request.class.php:458 inc/request.class.php:503 134 | #: inc/request.class.php:907 inc/validation.class.php:98 135 | #: inc/validation.class.php:205 136 | msgid "Number" 137 | msgstr "Nummer" 138 | 139 | #: inc/request.class.php:489 140 | msgid "Add to cart" 141 | msgstr "Zum Warenkorb hinzufügen" 142 | 143 | #: inc/request.class.php:498 144 | msgid "Cart" 145 | msgstr "Warenkorb" 146 | 147 | #: inc/request.class.php:853 148 | msgid "Consumable affected" 149 | msgid_plural "Consumables affected" 150 | msgstr[0] "Betroffenes Verbrauchsmaterial" 151 | msgstr[1] "Betroffene Verbrauchsmaterialien" 152 | 153 | #: inc/request.class.php:870 154 | msgid "Please add consumables in cart" 155 | msgstr "Bitte Verbrauchsmaterialien zu Warenkorb hinzufügen" 156 | 157 | #: inc/validation.class.php:336 158 | msgid "Refuse" 159 | msgstr "Ablehnen" 160 | 161 | #: inc/validation.class.php:434 162 | #, php-format 163 | msgid "Not enough stock for consumable %s" 164 | msgstr "Nicht genug Verbrauchsmaterial auf Lager %s" 165 | 166 | #: inc/wizard.class.php:52 167 | msgid "Consumables wizard" 168 | msgstr "Verbrauchsmaterialien-Assistent" 169 | -------------------------------------------------------------------------------- /locales/fr_FR.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Amandine Manceau, 2017 7 | # tynet , 2012 8 | # Xavier CAILLAUD , 2019-2020 9 | # Xavier CAILLAUD , 2012,2015-2016 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: GLPI Project - consumables plugin\n" 13 | "Report-Msgid-Bugs-To: \n" 14 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 15 | "PO-Revision-Date: 2020-07-21 10:05+0000\n" 16 | "Last-Translator: Xavier CAILLAUD \n" 17 | "Language-Team: French (France) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/fr_FR/)\n" 18 | "MIME-Version: 1.0\n" 19 | "Content-Type: text/plain; charset=UTF-8\n" 20 | "Content-Transfer-Encoding: 8bit\n" 21 | "Language: fr_FR\n" 22 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 23 | 24 | #: hook.php:166 inc/field.class.php:75 25 | msgid "Order reference" 26 | msgstr "Référence commande" 27 | 28 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 29 | msgid "Maximum number allowed for request" 30 | msgstr "Nombre maximal autorisé pour la demande" 31 | 32 | #: hook.php:188 inc/option.class.php:133 33 | msgid "Allowed groups for request" 34 | msgstr "Groupes autorisés à faire des demandes" 35 | 36 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 37 | msgid "Add a group for request" 38 | msgstr "Ajouter un groupe pour les demandes" 39 | 40 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 41 | #: inc/notificationtargetrequest.class.php:51 42 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 43 | #: inc/request.class.php:390 inc/request.class.php:396 44 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 45 | #: inc/wizard.class.php:79 46 | msgid "Consumable request" 47 | msgid_plural "Consumable requests" 48 | msgstr[0] "Demande de consommables" 49 | msgstr[1] "Demandes de consommables" 50 | 51 | #: inc/notificationtargetrequest.class.php:52 52 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 53 | #: inc/profile.class.php:210 inc/validation.class.php:64 54 | #: inc/validation.class.php:91 inc/wizard.class.php:87 55 | msgid "Consumable validation" 56 | msgstr "Validation des demandes de consommables" 57 | 58 | #: inc/notificationtargetrequest.class.php:63 59 | #: inc/notificationtargetrequest.class.php:109 60 | msgid "Consumable ID" 61 | msgstr "Consommable ID" 62 | 63 | #: inc/notificationtargetrequest.class.php:110 64 | msgid "Type of event" 65 | msgstr "Type d'événement" 66 | 67 | #: inc/notificationtargetrequest.class.php:130 68 | msgid "Display each consumable" 69 | msgstr "Montrer chaque consommable" 70 | 71 | #: inc/notificationtargetrequest.class.php:145 72 | msgid "Consumable approver" 73 | msgstr "Valideur de consommables" 74 | 75 | #: inc/notificationtargetrequest.class.php:146 76 | msgid "Consumable requester" 77 | msgstr "Demandeur de consommables" 78 | 79 | #: inc/notificationtargetrequest.class.php:147 80 | msgid "Consumable recipient" 81 | msgstr "Destinataire du consommable" 82 | 83 | #: inc/option.class.php:51 84 | msgid "Consumable request options" 85 | msgstr "Options de demande de consommable" 86 | 87 | #: inc/option.class.php:120 88 | msgctxt "button" 89 | msgid "Define" 90 | msgstr "Définir" 91 | 92 | #: inc/profile.class.php:146 93 | msgid "Advanced" 94 | msgstr "Avancé" 95 | 96 | #: inc/profile.class.php:158 inc/profile.class.php:202 97 | #: inc/servicecatalog.class.php:81 98 | msgid "Make a consumable request" 99 | msgstr "Faire une demande de consommables" 100 | 101 | #: inc/profile.class.php:166 102 | msgid "Make a consumable request for all users" 103 | msgstr "Faire une demande de consommables pour tous les utilisateurs" 104 | 105 | #: inc/profile.class.php:171 106 | msgid "Make a consumable request for my groups" 107 | msgstr "Faire une demande de consommables pour mes groupes" 108 | 109 | #: inc/profile.class.php:191 110 | msgid "Consumable" 111 | msgid_plural "Consumables" 112 | msgstr[0] "Consommable" 113 | msgstr[1] "Consommables" 114 | 115 | #: inc/profile.class.php:198 116 | msgid "Make a consumable request for users" 117 | msgstr "Faire une demande de consommables pour les utilisateurs" 118 | 119 | #: inc/profile.class.php:206 120 | msgid "Make a consumable request for groups" 121 | msgstr "Faire une demande de consommables pour les groupes" 122 | 123 | #: inc/request.class.php:177 inc/request.class.php:326 124 | #: inc/request.class.php:362 125 | msgid "Consumable request report" 126 | msgstr "Rapport des demandes de consommables" 127 | 128 | #: inc/request.class.php:216 129 | msgid "Consumable requests history" 130 | msgstr "Historique des demandes de consommables" 131 | 132 | #: inc/request.class.php:248 133 | msgid "Consumables request search" 134 | msgstr "Recherche des demandes de consommables" 135 | 136 | #: inc/request.class.php:422 inc/request.class.php:467 137 | #: inc/request.class.php:830 inc/validation.class.php:129 138 | msgid "Number" 139 | msgstr "Nombre" 140 | 141 | #: inc/request.class.php:453 142 | msgid "Add to cart" 143 | msgstr "Ajouter au panier" 144 | 145 | #: inc/request.class.php:462 146 | msgid "Cart" 147 | msgstr "Panier" 148 | 149 | #: inc/request.class.php:776 150 | msgid "Consumable affected" 151 | msgid_plural "Consumables affected" 152 | msgstr[0] "Demande de consommable ajoutée" 153 | msgstr[1] "Demande de consommables ajoutée" 154 | 155 | #: inc/request.class.php:793 156 | msgid "Please add consumables in cart" 157 | msgstr "Veuillez ajouter des demandes de consommable dans la panier" 158 | 159 | #: inc/validation.class.php:255 160 | msgid "Refuse" 161 | msgstr "Refuser" 162 | 163 | #: inc/validation.class.php:350 164 | #, php-format 165 | msgid "Not enough stock for consumable %s" 166 | msgstr "Pas assez de stock pour le consommable %s" 167 | 168 | #: inc/wizard.class.php:52 169 | msgid "Consumables wizard" 170 | msgstr "Assistant de demande de consommables" 171 | -------------------------------------------------------------------------------- /locales/es_EC.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Soporte Infraestructura Standby, 2023 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI Project - consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2022-11-28 10:11+0000\n" 12 | "PO-Revision-Date: 2015-09-17 11:45+0000\n" 13 | "Last-Translator: Soporte Infraestructura Standby, 2023\n" 14 | "Language-Team: Spanish (Ecuador) (http://app.transifex.com/infotelGLPI/GLPI_consumables/language/es_EC/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: es_EC\n" 19 | "Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" 20 | 21 | #: hook.php:165 inc/field.class.php:75 22 | msgid "Order reference" 23 | msgstr "Referencia del pedido" 24 | 25 | #: hook.php:175 hook.php:207 inc/option.class.php:111 inc/option.class.php:306 26 | msgid "Maximum number allowed for request" 27 | msgstr "Número máximo de solicitudes permitidas" 28 | 29 | #: hook.php:187 inc/option.class.php:132 30 | msgid "Allowed groups for request" 31 | msgstr "Grupos permitidos para la solicitud" 32 | 33 | #: hook.php:209 inc/option.class.php:183 inc/option.class.php:316 34 | msgid "Add a group for request" 35 | msgstr "Añadir un grupo para solicitar" 36 | 37 | #: setup.php:94 inc/field.class.php:54 inc/menu.class.php:41 38 | #: inc/notificationtargetrequest.class.php:51 39 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:53 40 | #: inc/request.class.php:436 inc/request.class.php:443 41 | #: inc/servicecatalog.class.php:73 inc/wizard.class.php:69 42 | #: inc/wizard.class.php:78 43 | msgid "Consumable request" 44 | msgid_plural "Consumable requests" 45 | msgstr[0] "Solicitudes de consumibles" 46 | msgstr[1] "Solicitudes de consumibles" 47 | msgstr[2] "Solicitudes de consumibles" 48 | 49 | #: front/wizard.form.php:53 inc/notificationtargetrequest.class.php:52 50 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:160 51 | #: inc/profile.class.php:223 inc/validation.class.php:139 52 | #: inc/validation.class.php:166 inc/wizard.class.php:86 53 | msgid "Consumable validation" 54 | msgstr "Validación de consumibles" 55 | 56 | #: inc/notificationtargetrequest.class.php:63 57 | #: inc/notificationtargetrequest.class.php:120 58 | msgid "Consumable ID" 59 | msgstr "ID de consumibles" 60 | 61 | #: inc/notificationtargetrequest.class.php:121 62 | msgid "Type of event" 63 | msgstr "Tipo de evento" 64 | 65 | #: inc/notificationtargetrequest.class.php:142 66 | msgid "Display each consumable" 67 | msgstr "Mostrar cada consumible" 68 | 69 | #: inc/notificationtargetrequest.class.php:157 70 | msgid "Consumable approver" 71 | msgstr "Aprobador de consumibles" 72 | 73 | #: inc/notificationtargetrequest.class.php:158 74 | msgid "Consumable requester" 75 | msgstr "Solicitante de consumibles" 76 | 77 | #: inc/notificationtargetrequest.class.php:159 78 | msgid "Consumable recipient" 79 | msgstr "Receptor de consumibles" 80 | 81 | #: inc/option.class.php:51 82 | msgid "Consumable request options" 83 | msgstr "Opciones de solicitud de consumibles" 84 | 85 | #: inc/option.class.php:119 86 | msgctxt "button" 87 | msgid "Define" 88 | msgstr "Definir" 89 | 90 | #: inc/profile.class.php:152 91 | msgid "Advanced" 92 | msgstr "Avanzado" 93 | 94 | #: inc/profile.class.php:164 inc/profile.class.php:215 95 | #: inc/servicecatalog.class.php:100 96 | msgid "Make a consumable request" 97 | msgstr "Realizar una solicitud de consumibles" 98 | 99 | #: inc/profile.class.php:172 100 | msgid "Make a consumable request for all users" 101 | msgstr "Realizar una solicitud de consumibles para todos los usuarios" 102 | 103 | #: inc/profile.class.php:177 104 | msgid "Make a consumable request for my groups" 105 | msgstr "Realizar una solicitud de consumibles para mis grupos" 106 | 107 | #: inc/profile.class.php:204 108 | msgid "Consumable" 109 | msgid_plural "Consumables" 110 | msgstr[0] "Consumibles" 111 | msgstr[1] "Consumibles" 112 | msgstr[2] "Consumibles" 113 | 114 | #: inc/profile.class.php:211 115 | msgid "Make a consumable request for users" 116 | msgstr "Realizar una solicitud de consumibles para los usuarios" 117 | 118 | #: inc/profile.class.php:219 119 | msgid "Make a consumable request for groups" 120 | msgstr "Realizar una solicitud de consumibles para grupos" 121 | 122 | #: inc/request.class.php:214 inc/request.class.php:370 123 | #: inc/request.class.php:406 124 | msgid "Consumable request report" 125 | msgstr "Informe de solicitud de consumibles" 126 | 127 | #: inc/request.class.php:253 128 | msgid "Consumable requests history" 129 | msgstr "Historial de solicitudes de consumibles" 130 | 131 | #: inc/request.class.php:285 132 | msgid "Consumables request search" 133 | msgstr "Búsqueda de solicitudes de consumibles" 134 | 135 | #: inc/request.class.php:473 inc/request.class.php:518 136 | #: inc/request.class.php:931 inc/validation.class.php:98 137 | #: inc/validation.class.php:205 138 | msgid "Number" 139 | msgstr "Número" 140 | 141 | #: inc/request.class.php:504 142 | msgid "Add to cart" 143 | msgstr "Añadir al carrito" 144 | 145 | #: inc/request.class.php:513 146 | msgid "Cart" 147 | msgstr "Carro" 148 | 149 | #: inc/request.class.php:874 150 | msgid "Consumable affected" 151 | msgid_plural "Consumables affected" 152 | msgstr[0] "Consumibles afectados" 153 | msgstr[1] "Consumibles afectados" 154 | msgstr[2] "Consumibles afectados" 155 | 156 | #: inc/request.class.php:893 157 | msgid "Please add consumables in cart" 158 | msgstr "Añadir consumibles al carrito" 159 | 160 | #: inc/validation.class.php:336 161 | msgid "Refuse" 162 | msgstr "Denegar " 163 | 164 | #: inc/validation.class.php:434 165 | #, php-format 166 | msgid "Not enough stock for consumable %s" 167 | msgstr "No hay suficientes existencias de consumibles 1%s" 168 | 169 | #: inc/wizard.class.php:52 170 | msgid "Consumables wizard" 171 | msgstr "Asistente de consumibles" 172 | -------------------------------------------------------------------------------- /locales/pl_PL.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Marcin Czarnecki , 2018 7 | # Ryszard Jeziorski , 2018 8 | msgid "" 9 | msgstr "" 10 | "Project-Id-Version: GLPI Project - consumables plugin\n" 11 | "Report-Msgid-Bugs-To: \n" 12 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 13 | "PO-Revision-Date: 2020-07-21 09:58+0000\n" 14 | "Last-Translator: Xavier CAILLAUD \n" 15 | "Language-Team: Polish (Poland) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/pl_PL/)\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Language: pl_PL\n" 20 | "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" 21 | 22 | #: hook.php:166 inc/field.class.php:75 23 | msgid "Order reference" 24 | msgstr "" 25 | 26 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 27 | msgid "Maximum number allowed for request" 28 | msgstr "Maksymalna ilość możliwia do wybrania w zapotrzebowaniu" 29 | 30 | #: hook.php:188 inc/option.class.php:133 31 | msgid "Allowed groups for request" 32 | msgstr "Grupy użytkowników, które mogą wysyłać zapotrzebowanie" 33 | 34 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 35 | msgid "Add a group for request" 36 | msgstr "Dodaj grupę do zapotrzebowania" 37 | 38 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 39 | #: inc/notificationtargetrequest.class.php:51 40 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 41 | #: inc/request.class.php:390 inc/request.class.php:396 42 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 43 | #: inc/wizard.class.php:79 44 | msgid "Consumable request" 45 | msgid_plural "Consumable requests" 46 | msgstr[0] "Zapotrzebowanie na materiały elsploatacyjne" 47 | msgstr[1] "Zapotrzebowania na materiały elsploatacyjne" 48 | msgstr[2] "Zapotrzebowania na materiały elsploatacyjne" 49 | msgstr[3] "Zapotrzebowania na materiały elsploatacyjne" 50 | 51 | #: inc/notificationtargetrequest.class.php:52 52 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 53 | #: inc/profile.class.php:210 inc/validation.class.php:64 54 | #: inc/validation.class.php:91 inc/wizard.class.php:87 55 | msgid "Consumable validation" 56 | msgstr "Zatwierdzenie zapotrzebowania" 57 | 58 | #: inc/notificationtargetrequest.class.php:63 59 | #: inc/notificationtargetrequest.class.php:109 60 | msgid "Consumable ID" 61 | msgstr "Identyfikator materiału ekploatacyjnego" 62 | 63 | #: inc/notificationtargetrequest.class.php:110 64 | msgid "Type of event" 65 | msgstr "Typ zdarzenia" 66 | 67 | #: inc/notificationtargetrequest.class.php:130 68 | msgid "Display each consumable" 69 | msgstr "Wyświetl każdy materiał eksploatacyjny" 70 | 71 | #: inc/notificationtargetrequest.class.php:145 72 | msgid "Consumable approver" 73 | msgstr "" 74 | 75 | #: inc/notificationtargetrequest.class.php:146 76 | msgid "Consumable requester" 77 | msgstr "" 78 | 79 | #: inc/notificationtargetrequest.class.php:147 80 | msgid "Consumable recipient" 81 | msgstr "" 82 | 83 | #: inc/option.class.php:51 84 | msgid "Consumable request options" 85 | msgstr "Konfiguracja zapotrzebowania na materiały eksploatacyjne" 86 | 87 | #: inc/option.class.php:120 88 | msgctxt "button" 89 | msgid "Define" 90 | msgstr "Ustaw" 91 | 92 | #: inc/profile.class.php:146 93 | msgid "Advanced" 94 | msgstr "Dodatkowe" 95 | 96 | #: inc/profile.class.php:158 inc/profile.class.php:202 97 | #: inc/servicecatalog.class.php:81 98 | msgid "Make a consumable request" 99 | msgstr "Tworzenie zapotrzebowania na materiały eksploatacyjne" 100 | 101 | #: inc/profile.class.php:166 102 | msgid "Make a consumable request for all users" 103 | msgstr "Tworzenie zapotrzebowanie na materiały eksploatacyjne dla wszystkich użytkowników" 104 | 105 | #: inc/profile.class.php:171 106 | msgid "Make a consumable request for my groups" 107 | msgstr "Tworzenie zapotrzebowanie na materiały eksploatacyjne dla wszystkich grup" 108 | 109 | #: inc/profile.class.php:191 110 | msgid "Consumable" 111 | msgid_plural "Consumables" 112 | msgstr[0] "Materiał eksploatacyjny" 113 | msgstr[1] "Materiały eksploatacyjne" 114 | msgstr[2] "Materiałów eksploatacyjnych" 115 | msgstr[3] "Materiały eksploatacyjne" 116 | 117 | #: inc/profile.class.php:198 118 | msgid "Make a consumable request for users" 119 | msgstr "Tworzenie zapotrzebowanie na materiały eksploatacyjne dla użytkowników" 120 | 121 | #: inc/profile.class.php:206 122 | msgid "Make a consumable request for groups" 123 | msgstr "Tworzenie zapotrzebowanie na materiały eksploatacyjne dla grup" 124 | 125 | #: inc/request.class.php:177 inc/request.class.php:326 126 | #: inc/request.class.php:362 127 | msgid "Consumable request report" 128 | msgstr "Lista zapotrzebowań" 129 | 130 | #: inc/request.class.php:216 131 | msgid "Consumable requests history" 132 | msgstr "" 133 | 134 | #: inc/request.class.php:248 135 | msgid "Consumables request search" 136 | msgstr "Wyszukiwanie zapotrzebowania na materiały eksploatacyjne dla grup" 137 | 138 | #: inc/request.class.php:422 inc/request.class.php:467 139 | #: inc/request.class.php:830 inc/validation.class.php:129 140 | msgid "Number" 141 | msgstr "Ilość" 142 | 143 | #: inc/request.class.php:453 144 | msgid "Add to cart" 145 | msgstr "Dodaj do koszyka" 146 | 147 | #: inc/request.class.php:462 148 | msgid "Cart" 149 | msgstr "Koszyk" 150 | 151 | #: inc/request.class.php:776 152 | msgid "Consumable affected" 153 | msgid_plural "Consumables affected" 154 | msgstr[0] "" 155 | msgstr[1] "" 156 | msgstr[2] "" 157 | msgstr[3] "" 158 | 159 | #: inc/request.class.php:793 160 | msgid "Please add consumables in cart" 161 | msgstr "" 162 | 163 | #: inc/validation.class.php:255 164 | msgid "Refuse" 165 | msgstr "Odrzuć" 166 | 167 | #: inc/validation.class.php:350 168 | #, php-format 169 | msgid "Not enough stock for consumable %s" 170 | msgstr "" 171 | 172 | #: inc/wizard.class.php:52 173 | msgid "Consumables wizard" 174 | msgstr "" 175 | -------------------------------------------------------------------------------- /locales/cs_CZ.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Pavel Borecki , 2018-2019 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI Project - consumables plugin\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2020-11-02 17:35+0100\n" 12 | "PO-Revision-Date: 2020-07-21 09:58+0000\n" 13 | "Last-Translator: Xavier CAILLAUD \n" 14 | "Language-Team: Czech (Czech Republic) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/cs_CZ/)\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language: cs_CZ\n" 19 | "Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" 20 | 21 | #: hook.php:166 inc/field.class.php:75 22 | msgid "Order reference" 23 | msgstr "Reference objednávky" 24 | 25 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 26 | msgid "Maximum number allowed for request" 27 | msgstr "Nejvyšší množství, o které je možné žádat" 28 | 29 | #: hook.php:188 inc/option.class.php:133 30 | msgid "Allowed groups for request" 31 | msgstr "Skupiny které mohou žádat" 32 | 33 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 34 | msgid "Add a group for request" 35 | msgstr "Přidat skupinu pro požadavek" 36 | 37 | #: setup.php:82 inc/field.class.php:54 inc/menu.class.php:41 38 | #: inc/notificationtargetrequest.class.php:51 39 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 40 | #: inc/request.class.php:390 inc/request.class.php:396 41 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 42 | #: inc/wizard.class.php:79 43 | msgid "Consumable request" 44 | msgid_plural "Consumable requests" 45 | msgstr[0] "Požadavek na spotřební materiál" 46 | msgstr[1] "Požadavky na spotřební materiál" 47 | msgstr[2] "Požadavků na spotřební materiál" 48 | msgstr[3] "Požadavky na spotřební materiál" 49 | 50 | #: inc/notificationtargetrequest.class.php:52 51 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 52 | #: inc/profile.class.php:210 inc/validation.class.php:64 53 | #: inc/validation.class.php:91 inc/wizard.class.php:87 54 | msgid "Consumable validation" 55 | msgstr "Ověření požadavku na spotřební materiál" 56 | 57 | #: inc/notificationtargetrequest.class.php:63 58 | #: inc/notificationtargetrequest.class.php:109 59 | msgid "Consumable ID" 60 | msgstr "Identifikátor spotřebního materiálu" 61 | 62 | #: inc/notificationtargetrequest.class.php:110 63 | msgid "Type of event" 64 | msgstr "Typ události" 65 | 66 | #: inc/notificationtargetrequest.class.php:130 67 | msgid "Display each consumable" 68 | msgstr "Zobrazit každou položku spotřebního materiálu" 69 | 70 | #: inc/notificationtargetrequest.class.php:145 71 | msgid "Consumable approver" 72 | msgstr "Schvalovatel spotřebního materiálu" 73 | 74 | #: inc/notificationtargetrequest.class.php:146 75 | msgid "Consumable requester" 76 | msgstr "Žadatel o spotřební materiál" 77 | 78 | #: inc/notificationtargetrequest.class.php:147 79 | msgid "Consumable recipient" 80 | msgstr "" 81 | 82 | #: inc/option.class.php:51 83 | msgid "Consumable request options" 84 | msgstr "Možnosti požadavku na spotřební materiál" 85 | 86 | #: inc/option.class.php:120 87 | msgctxt "button" 88 | msgid "Define" 89 | msgstr "Určit" 90 | 91 | #: inc/profile.class.php:146 92 | msgid "Advanced" 93 | msgstr "Pokročilé" 94 | 95 | #: inc/profile.class.php:158 inc/profile.class.php:202 96 | #: inc/servicecatalog.class.php:81 97 | msgid "Make a consumable request" 98 | msgstr "Zažádat o spotřební materiál" 99 | 100 | #: inc/profile.class.php:166 101 | msgid "Make a consumable request for all users" 102 | msgstr "Zažádat o spotřební materiál pro všechny uživatele" 103 | 104 | #: inc/profile.class.php:171 105 | msgid "Make a consumable request for my groups" 106 | msgstr "Zažádat o spotřební materiál pro mé skupiny" 107 | 108 | #: inc/profile.class.php:191 109 | msgid "Consumable" 110 | msgid_plural "Consumables" 111 | msgstr[0] "Spotřební materiál" 112 | msgstr[1] "Spotřební materiál" 113 | msgstr[2] "Spotřební materiál" 114 | msgstr[3] "Spotřební materiál" 115 | 116 | #: inc/profile.class.php:198 117 | msgid "Make a consumable request for users" 118 | msgstr "Zažádat o spotřební materiál pro uživatele" 119 | 120 | #: inc/profile.class.php:206 121 | msgid "Make a consumable request for groups" 122 | msgstr "Zažádat o spotřební materiál pro skupiny" 123 | 124 | #: inc/request.class.php:177 inc/request.class.php:326 125 | #: inc/request.class.php:362 126 | msgid "Consumable request report" 127 | msgstr "Zpráva o požadavcích na spotřební materiál" 128 | 129 | #: inc/request.class.php:216 130 | msgid "Consumable requests history" 131 | msgstr "Historie požadavků na spotřební materiál" 132 | 133 | #: inc/request.class.php:248 134 | msgid "Consumables request search" 135 | msgstr "Hledat požadavky na spotřební materiál" 136 | 137 | #: inc/request.class.php:422 inc/request.class.php:467 138 | #: inc/request.class.php:830 inc/validation.class.php:129 139 | msgid "Number" 140 | msgstr "Počet" 141 | 142 | #: inc/request.class.php:453 143 | msgid "Add to cart" 144 | msgstr "Přidat do košíku" 145 | 146 | #: inc/request.class.php:462 147 | msgid "Cart" 148 | msgstr "Košík" 149 | 150 | #: inc/request.class.php:776 151 | msgid "Consumable affected" 152 | msgid_plural "Consumables affected" 153 | msgstr[0] "Požadavek na spotřební materiál přidán" 154 | msgstr[1] "Požadavky na spotřební materiál přidány" 155 | msgstr[2] "Požadavků na spotřební materiál přidáno" 156 | msgstr[3] "Požadavky na spotřební materiál přidány" 157 | 158 | #: inc/request.class.php:793 159 | msgid "Please add consumables in cart" 160 | msgstr "Vložte spotřební materiál do košíku" 161 | 162 | #: inc/validation.class.php:255 163 | msgid "Refuse" 164 | msgstr "Zamítnout" 165 | 166 | #: inc/validation.class.php:350 167 | #, php-format 168 | msgid "Not enough stock for consumable %s" 169 | msgstr "Na skladě není dostatek spotřebního materiálu %s" 170 | 171 | #: inc/wizard.class.php:52 172 | msgid "Consumables wizard" 173 | msgstr "Průvodce žádostí o spotřební materiál" 174 | -------------------------------------------------------------------------------- /locales/ru_RU.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Consumables Development Team 3 | # This file is distributed under the same license as the GLPI - Consumables plugin package. 4 | # 5 | # Translators: 6 | # Alexandr Dyuzhev , 2021 7 | # Andrey Saridzha, 2015 8 | # Andrey Saridzha, 2015 9 | # Kirill Lavrik , 2018 10 | # Nikolai Petrov , 2017 11 | msgid "" 12 | msgstr "" 13 | "Project-Id-Version: GLPI Project - consumables plugin\n" 14 | "Report-Msgid-Bugs-To: \n" 15 | "POT-Creation-Date: 2021-02-27 12:39+0000\n" 16 | "PO-Revision-Date: 2021-04-02 07:19+0000\n" 17 | "Last-Translator: Александр Дюжев \n" 18 | "Language-Team: Russian (Russia) (http://www.transifex.com/infotelGLPI/GLPI_consumables/language/ru_RU/)\n" 19 | "MIME-Version: 1.0\n" 20 | "Content-Type: text/plain; charset=UTF-8\n" 21 | "Content-Transfer-Encoding: 8bit\n" 22 | "Language: ru_RU\n" 23 | "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" 24 | 25 | #: hook.php:166 inc/field.class.php:75 26 | msgid "Order reference" 27 | msgstr "Код заказа" 28 | 29 | #: hook.php:176 hook.php:208 inc/option.class.php:111 inc/option.class.php:305 30 | msgid "Maximum number allowed for request" 31 | msgstr "Максимально допустимое количество запросов" 32 | 33 | #: hook.php:188 inc/option.class.php:133 34 | msgid "Allowed groups for request" 35 | msgstr "Разрешенные группы для запроса" 36 | 37 | #: hook.php:210 inc/option.class.php:184 inc/option.class.php:315 38 | msgid "Add a group for request" 39 | msgstr "Добавить группу для запроса" 40 | 41 | #: setup.php:83 inc/field.class.php:54 inc/menu.class.php:41 42 | #: inc/notificationtargetrequest.class.php:51 43 | #: inc/notificationtargetrequest.class.php:66 inc/request.class.php:52 44 | #: inc/request.class.php:412 inc/request.class.php:418 45 | #: inc/servicecatalog.class.php:65 inc/wizard.class.php:70 46 | #: inc/wizard.class.php:79 47 | msgid "Consumable request" 48 | msgid_plural "Consumable requests" 49 | msgstr[0] "Заказ расходных материалов" 50 | msgstr[1] "Заказы расходных материалов" 51 | msgstr[2] "Заказы расходных материалов" 52 | msgstr[3] "Заказ расходных материалов" 53 | 54 | #: inc/notificationtargetrequest.class.php:52 55 | #: inc/notificationtargetrequest.class.php:69 inc/profile.class.php:154 56 | #: inc/profile.class.php:210 inc/validation.class.php:139 57 | #: inc/validation.class.php:166 inc/wizard.class.php:87 58 | msgid "Consumable validation" 59 | msgstr "Подтверждение получения расходных материалов" 60 | 61 | #: inc/notificationtargetrequest.class.php:63 62 | #: inc/notificationtargetrequest.class.php:120 63 | msgid "Consumable ID" 64 | msgstr "ID расходного материала" 65 | 66 | #: inc/notificationtargetrequest.class.php:121 67 | msgid "Type of event" 68 | msgstr "Тип события" 69 | 70 | #: inc/notificationtargetrequest.class.php:142 71 | msgid "Display each consumable" 72 | msgstr "Показывать каждый расходный материал" 73 | 74 | #: inc/notificationtargetrequest.class.php:157 75 | msgid "Consumable approver" 76 | msgstr "Утверждающий расходные материалы" 77 | 78 | #: inc/notificationtargetrequest.class.php:158 79 | msgid "Consumable requester" 80 | msgstr "Заказчик расходных материалов" 81 | 82 | #: inc/notificationtargetrequest.class.php:159 83 | msgid "Consumable recipient" 84 | msgstr "Получатель расходного материала" 85 | 86 | #: inc/option.class.php:51 87 | msgid "Consumable request options" 88 | msgstr "Свойства запроса расходных материалов" 89 | 90 | #: inc/option.class.php:120 91 | msgctxt "button" 92 | msgid "Define" 93 | msgstr "Определить" 94 | 95 | #: inc/profile.class.php:146 96 | msgid "Advanced" 97 | msgstr "Расширенные" 98 | 99 | #: inc/profile.class.php:158 inc/profile.class.php:202 100 | #: inc/servicecatalog.class.php:81 101 | msgid "Make a consumable request" 102 | msgstr "Создать запрос расходных материалов" 103 | 104 | #: inc/profile.class.php:166 105 | msgid "Make a consumable request for all users" 106 | msgstr "Создать запрос расходных материалов для всех групп" 107 | 108 | #: inc/profile.class.php:171 109 | msgid "Make a consumable request for my groups" 110 | msgstr "Создать запрос расходных материалов для своей группы" 111 | 112 | #: inc/profile.class.php:191 113 | msgid "Consumable" 114 | msgid_plural "Consumables" 115 | msgstr[0] "Расходные материалы" 116 | msgstr[1] "Расходные материалы" 117 | msgstr[2] "Расходные материалы" 118 | msgstr[3] "Расходные материалы" 119 | 120 | #: inc/profile.class.php:198 121 | msgid "Make a consumable request for users" 122 | msgstr "Создать запрос расходных материалов для пользователей" 123 | 124 | #: inc/profile.class.php:206 125 | msgid "Make a consumable request for groups" 126 | msgstr "Создать запрос расходных материалов для групп" 127 | 128 | #: inc/request.class.php:198 inc/request.class.php:348 129 | #: inc/request.class.php:384 130 | msgid "Consumable request report" 131 | msgstr "Отчет по запросам расходных материалов" 132 | 133 | #: inc/request.class.php:237 134 | msgid "Consumable requests history" 135 | msgstr "История запросов расходных материалов" 136 | 137 | #: inc/request.class.php:269 138 | msgid "Consumables request search" 139 | msgstr "Поиск запросов расходных материалов" 140 | 141 | #: inc/request.class.php:444 inc/request.class.php:489 142 | #: inc/request.class.php:861 inc/validation.class.php:98 143 | #: inc/validation.class.php:204 144 | msgid "Number" 145 | msgstr "Количество" 146 | 147 | #: inc/request.class.php:475 148 | msgid "Add to cart" 149 | msgstr "Добавить в заказ" 150 | 151 | #: inc/request.class.php:484 152 | msgid "Cart" 153 | msgstr "Заказ" 154 | 155 | #: inc/request.class.php:807 156 | msgid "Consumable affected" 157 | msgid_plural "Consumables affected" 158 | msgstr[0] "Заказ оформлен" 159 | msgstr[1] "Заказ оформлен" 160 | msgstr[2] "Заказ оформлен" 161 | msgstr[3] "Заказ оформлен" 162 | 163 | #: inc/request.class.php:824 164 | msgid "Please add consumables in cart" 165 | msgstr "Добавьте расходные материалы в заказ" 166 | 167 | #: inc/validation.class.php:330 168 | msgid "Refuse" 169 | msgstr "Отказаться" 170 | 171 | #: inc/validation.class.php:425 172 | #, php-format 173 | msgid "Not enough stock for consumable %s" 174 | msgstr "Не достаточно запаса расходного материала %s " 175 | 176 | #: inc/wizard.class.php:52 177 | msgid "Consumables wizard" 178 | msgstr "Мастер заказа расходных материалов" 179 | -------------------------------------------------------------------------------- /hook.php: -------------------------------------------------------------------------------- 1 | . 28 | -------------------------------------------------------------------------- 29 | */ 30 | 31 | use GlpiPlugin\Consumables\Menu; 32 | use GlpiPlugin\Consumables\Option; 33 | use GlpiPlugin\Consumables\Profile; 34 | use GlpiPlugin\Consumables\Request; 35 | 36 | /** 37 | * @return bool 38 | */ 39 | function plugin_consumables_install() 40 | { 41 | global $DB; 42 | 43 | if (!$DB->tableExists("glpi_plugin_consumables_requests")) { 44 | // Install script 45 | $DB->runFile(PLUGIN_CONSUMABLES_DIR . "/install/sql/empty-2.0.1.sql"); 46 | include(PLUGIN_CONSUMABLES_DIR . "/install/install.php"); 47 | install_notifications_consumables(); 48 | } elseif (!$DB->tableExists("glpi_plugin_consumables_options")) { 49 | $DB->runFile(PLUGIN_CONSUMABLES_DIR . "/install/sql/update-1.2.2.sql"); 50 | } elseif (!$DB->fieldExists("glpi_plugin_consumables_options", "consumableitems_id")) { 51 | $DB->runFile(PLUGIN_CONSUMABLES_DIR . "/install/sql/update-2.0.1.sql"); 52 | } 53 | 54 | Profile::initProfile(); 55 | Profile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); 56 | 57 | return true; 58 | } 59 | 60 | /** 61 | * @return bool 62 | */ 63 | function plugin_consumables_uninstall() 64 | { 65 | global $DB; 66 | 67 | $tables = ["glpi_plugin_consumables_profiles", 68 | "glpi_plugin_consumables_requests", 69 | "glpi_plugin_consumables_options", 70 | "glpi_plugin_consumables_fields"]; 71 | 72 | foreach ($tables as $table) { 73 | $DB->dropTable($table, true); 74 | } 75 | 76 | $notif = new Notification(); 77 | $options = ['itemtype' => Request::class]; 78 | foreach ($DB->request([ 79 | 'FROM' => 'glpi_notifications', 80 | 'WHERE' => $options]) as $data) { 81 | $notif->delete($data); 82 | } 83 | 84 | //templates 85 | $template = new NotificationTemplate(); 86 | $translation = new NotificationTemplateTranslation(); 87 | $notif_template = new Notification_NotificationTemplate(); 88 | $options = ['itemtype' => Request::class]; 89 | foreach ($DB->request([ 90 | 'FROM' => 'glpi_notificationtemplates', 91 | 'WHERE' => $options]) as $data) { 92 | $options_template = [ 93 | 'notificationtemplates_id' => $data['id'] 94 | ]; 95 | 96 | foreach ($DB->request([ 97 | 'FROM' => 'glpi_notificationtemplatetranslations', 98 | 'WHERE' => $options_template]) as $data_template) { 99 | $translation->delete($data_template); 100 | } 101 | $template->delete($data); 102 | 103 | foreach ($DB->request([ 104 | 'FROM' => 'glpi_notifications_notificationtemplates', 105 | 'WHERE' => $options_template]) as $data_template) { 106 | $notif_template->delete($data_template); 107 | } 108 | } 109 | 110 | $itemtypes = ['Alert', 111 | 'DisplayPreference', 112 | 'Document_Item', 113 | 'ImpactItem', 114 | 'Item_Ticket', 115 | 'Link_Itemtype', 116 | 'Notepad', 117 | 'SavedSearch', 118 | 'DropdownTranslation', 119 | 'NotificationTemplate', 120 | 'Notification']; 121 | foreach ($itemtypes as $itemtype) { 122 | $item = new $itemtype; 123 | $item->deleteByCriteria(['itemtype' => Request::class]); 124 | } 125 | 126 | // Delete rights associated with the plugin 127 | $profileRight = new ProfileRight(); 128 | foreach (Profile::getAllRights() as $right) { 129 | $profileRight->deleteByCriteria(['name' => $right['field']]); 130 | } 131 | 132 | Menu::removeRightsFromSession(); 133 | 134 | Profile::removeRightsFromSession(); 135 | 136 | return true; 137 | } 138 | 139 | // Hook done on purge item case 140 | /** 141 | * @param $item 142 | */ 143 | function plugin_item_purge_consumables($item) 144 | { 145 | switch (get_class($item)) { 146 | case 'ConsumableItem': 147 | $temp = new Request(); 148 | $temp->deleteByCriteria(['consumableitems_id' => $item->getField('id')], 1); 149 | break; 150 | } 151 | } 152 | 153 | // Define dropdown relations 154 | /** 155 | * @return array 156 | */ 157 | function plugin_consumables_getDatabaseRelations() 158 | { 159 | 160 | if (Plugin::isPluginActive("consumables")) { 161 | return ["glpi_consumableitems" => ["glpi_plugin_consumables_requests" => "consumableitems_id", 162 | "glpi_plugin_consumables_options" => "consumableitems_id"]]; 163 | } else { 164 | return []; 165 | } 166 | } 167 | 168 | // Define search option for types of the plugins 169 | /** 170 | * @param $itemtype 171 | * 172 | * @return array 173 | */ 174 | function plugin_consumables_getAddSearchOptions($itemtype) 175 | { 176 | 177 | $sopt = []; 178 | 179 | if ($itemtype == "ConsumableItem") { 180 | if (Session::haveRight("plugin_consumables", READ)) { 181 | $sopt[185]['table'] = 'glpi_plugin_consumables_fields'; 182 | $sopt[185]['field'] = 'order_ref'; 183 | $sopt[185]['name'] = __('Order reference', 'consumables'); 184 | $sopt[185]['datatype'] = "text"; 185 | $sopt[185]['joinparams'] = ['jointype' => 'child', 186 | 'linkfield' => 'consumableitems_id']; 187 | $sopt[185]['massiveaction'] = false; 188 | 189 | $sopt[186]['table'] = 'glpi_plugin_consumables_options'; 190 | $sopt[186]['field'] = 'max_cart'; 191 | $sopt[186]['name'] = __('Maximum number allowed for request', 'consumables'); 192 | $sopt[186]['datatype'] = "number"; 193 | $sopt[186]['linkfield'] = "consumableitems_id"; 194 | $sopt[186]['joinparams'] = ['jointype' => 'child', 195 | 'linkfield' => 'consumableitems_id']; 196 | $sopt[186]['massiveaction'] = false; 197 | 198 | $sopt[187]['table'] = 'glpi_plugin_consumables_options'; 199 | $sopt[187]['field'] = 'groups'; 200 | $sopt[187]['name'] = __('Allowed groups for request', 'consumables'); 201 | $sopt[187]['datatype'] = "specific"; 202 | $sopt[187]['linkfield'] = "consumableitems_id"; 203 | $sopt[187]['joinparams'] = ['jointype' => 'child', 204 | 'linkfield' => 'consumableitems_id']; 205 | $sopt[187]['massiveaction'] = false; 206 | $sopt[187]['nosearch'] = true; 207 | } 208 | } 209 | 210 | return $sopt; 211 | } 212 | 213 | function plugin_consumables_MassiveActions($type) 214 | { 215 | 216 | switch ($type) { 217 | case 'ConsumableItem': 218 | return [ 219 | Option::class . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_number' 220 | => __('Maximum number allowed for request', 'consumables'), 221 | Option::class . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_groups' 222 | => __('Add a group for request', 'consumables')]; 223 | break; 224 | } 225 | return []; 226 | } 227 | -------------------------------------------------------------------------------- /public/js/consumables.js: -------------------------------------------------------------------------------- 1 | function consumables_initJs(root_doc, consumableTypeID, consumableID) { 2 | this.usedConsumables = {}; 3 | this.root_doc = root_doc; 4 | this.consumableTypeID = consumableTypeID; 5 | this.consumableID = consumableID; 6 | } 7 | 8 | 9 | /** 10 | * consumables_add_custom_values : add text input 11 | */ 12 | function consumables_addToCart(action, toobserve, toupdate) { 13 | 14 | var object = this; 15 | 16 | var formInput = getFormData(toobserve); 17 | 18 | $.ajax({ 19 | url: this.root_doc + '/ajax/request.php', 20 | type: "POST", 21 | dataType: "json", 22 | data: 'action=' + action + '&' + formInput, 23 | success: function (data) { 24 | if (data.success) { 25 | var item_bloc = $('#' + toupdate); 26 | var result = "\n"; 27 | // Insert row in cart 28 | $.each(data.fields, function (index, row) { 29 | if (row.hidden == undefined || !row.hidden) { // IS hidden row ? 30 | result += "" + row.label.replace(/\\["|']/g, '"') + "\n"; 32 | 33 | } else { 34 | result += ""; 36 | } 37 | }); 38 | 39 | // Push used consumables 40 | var number = object.usedConsumables[data.fields.consumableitems_id.value]; 41 | if (number === undefined) { 42 | object.usedConsumables[data.fields.consumableitems_id.value] = parseInt(data.fields.number.value); 43 | } else { 44 | object.usedConsumables[data.fields.consumableitems_id.value] = object.usedConsumables[data.fields.consumableitems_id.value] + parseInt(data.fields.number.value); 45 | } 46 | 47 | result += "" + 48 | ""; 49 | 50 | item_bloc.append(result); 51 | item_bloc.css({"display": 'table'}); 52 | 53 | // Reload consumable list 54 | consumables_reloadAvailableConsumablesNumber(); 55 | } else { 56 | consumables_showDialog(data.message, false); 57 | } 58 | } 59 | }); 60 | } 61 | 62 | function consumables_addConsumables(action, toobserve) { 63 | 64 | var formInput = getFormData(toobserve); 65 | 66 | $.ajax({ 67 | type: "POST", 68 | dataType: "json", 69 | url: this.root_doc + '/ajax/request.php', 70 | data: 'action=' + action + '&' + formInput, 71 | success: function (data) { 72 | consumables_showDialog(data.message, data.success); 73 | } 74 | }); 75 | } 76 | 77 | function consumables_showDialog(message, reload) { 78 | 79 | glpi_html_dialog({ 80 | title: __("Add to cart", "consumables"), 81 | body: message, 82 | id: 'add_badges', 83 | buttons: [{ 84 | label: __("Close"), 85 | click: function(event) { 86 | window.location.reload(); 87 | } 88 | }], 89 | }) 90 | } 91 | 92 | function consumables_searchConsumables(action, toobserve, toupdate,type) { 93 | 94 | var formInput = getFormData(toobserve); 95 | var item_bloc = $('#' + toupdate); 96 | 97 | // Loading 98 | item_bloc.html('
'); 99 | 100 | $.ajax({ 101 | type: "POST", 102 | dataType: "json", 103 | url: this.root_doc + '/ajax/request.php', 104 | data: 'action=' + action + '&'+'type='+type+'&' + formInput, 105 | success: function (data) { 106 | var result = data.message; 107 | 108 | item_bloc.html(result); 109 | 110 | var scripts, scriptsFinder = /]*>([\s\S]+?)<\/script>/gi; 111 | while (scripts = scriptsFinder.exec(result)) { 112 | eval(scripts[1]); 113 | } 114 | } 115 | }); 116 | 117 | } 118 | 119 | function consumables_reloadAvailableConsumables() { 120 | 121 | var type = this.consumableTypeID; 122 | 123 | $.ajax({ 124 | type: "POST", 125 | url: this.root_doc + '/ajax/request.php', 126 | data: { 127 | 'action': 'reloadAvailableConsumables', 128 | 'type': type 129 | }, 130 | success: function (result) { 131 | var item_bloc = $('#loadAvailableConsumables'); 132 | item_bloc.html(result); 133 | 134 | var scripts, scriptsFinder = /]*>([\s\S]+?)<\/script>/gi; 135 | while (scripts = scriptsFinder.exec(result)) { 136 | eval(scripts[1]); 137 | } 138 | } 139 | }); 140 | } 141 | 142 | function consumables_reloadAvailableConsumablesNumber() { 143 | 144 | $.ajax({ 145 | type: "POST", 146 | url: this.root_doc + '/ajax/request.php', 147 | data: { 148 | 'action': 'reloadAvailableConsumablesNumber', 149 | 'used': JSON.stringify(this.usedConsumables), 150 | 'consumableitems_id': this.consumableID 151 | }, 152 | success: function (result) { 153 | var item_bloc = $('#loadAvailableConsumablesNumber'); 154 | item_bloc.html(result); 155 | 156 | var scripts, scriptsFinder = /]*>([\s\S]+?)<\/script>/gi; 157 | while (scripts = scriptsFinder.exec(result)) { 158 | eval(scripts[1]); 159 | } 160 | } 161 | }); 162 | } 163 | 164 | function consumables_seeConsumablesInfos() { 165 | 166 | $.ajax({ 167 | type: "POST", 168 | url: this.root_doc + '/ajax/request.php', 169 | data: { 170 | 'action': 'seeConsumablesInfos', 171 | 'used': JSON.stringify(this.usedConsumables), 172 | 'consumableitems_id': this.consumableID 173 | }, 174 | success: function (result) { 175 | var item_bloc = $('#seeConsumablesInfos'); 176 | item_bloc.html(result); 177 | 178 | var scripts, scriptsFinder = /]*>([\s\S]+?)<\/script>/gi; 179 | while (scripts = scriptsFinder.exec(result)) { 180 | eval(scripts[1]); 181 | } 182 | } 183 | }); 184 | } 185 | 186 | /** 187 | * consumables_removeCart : delete text input 188 | * 189 | * @param field_id 190 | */ 191 | function consumables_removeCart(field_id) { 192 | var value = $("tr[id=" + field_id + "] input[id=number]").val(); 193 | var consumableitems_id = $("tr[id=" + field_id + "] input[id=consumableitems_id]").val(); 194 | 195 | // Remove element from used consumables variable 196 | this.usedConsumables[consumableitems_id] = this.usedConsumables[consumableitems_id] - parseInt(value); 197 | if (this.usedConsumables[consumableitems_id] < 0) { 198 | this.usedConsumables[consumableitems_id] = 0; 199 | } 200 | 201 | // Reload consumable list 202 | consumables_reloadAvailableConsumablesNumber(); 203 | 204 | // Remove cart row 205 | $('#' + field_id).remove(); 206 | } 207 | 208 | function consumables_cancel(url) { 209 | window.location.href = url; 210 | } 211 | 212 | 213 | /** 214 | * Get the form values and construct data url 215 | * 216 | * @param form 217 | */ 218 | function getFormData(form) { 219 | 220 | if (typeof(form) !== 'object') { 221 | var form = $('#' + form); 222 | } 223 | 224 | return encodeParameters(form[0]); 225 | } 226 | 227 | /** 228 | * Encode form parameters for URL 229 | * 230 | * @param elements 231 | */ 232 | function encodeParameters(elements) { 233 | var kvpairs = []; 234 | 235 | $.each(elements, function (index, e) { 236 | if (e.name != '') { 237 | switch (e.type) { 238 | case 'radio': 239 | case 'checkbox': 240 | if (e.checked) { 241 | kvpairs.push(encodeURIComponent(e.name) + "=" + encodeURIComponent(e.value)); 242 | } 243 | break; 244 | case 'select-multiple': 245 | var name = e.name.replace("[", "").replace("]", ""); 246 | $.each(e.selectedOptions, function (index, option) { 247 | kvpairs.push(encodeURIComponent(name + '[' + option.index + ']') + '=' + encodeURIComponent(option.value)); 248 | }); 249 | break; 250 | default: 251 | kvpairs.push(encodeURIComponent(e.name) + "=" + encodeURIComponent(e.value)); 252 | break; 253 | } 254 | } 255 | }); 256 | 257 | return kvpairs.join("&"); 258 | } 259 | -------------------------------------------------------------------------------- /install/install.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | use GlpiPlugin\Consumables\Request; 31 | 32 | /** 33 | * Install 34 | * 35 | * @return bool for success (will die for most error) 36 | * */ 37 | function install_notifications_consumables() 38 | { 39 | global $DB; 40 | 41 | $migration = new Migration(100); 42 | 43 | // Notification 44 | // Request 45 | $options_notif = ['itemtype' => Request::class, 46 | 'name' => 'Consumables Request']; 47 | $DB->insert( 48 | "glpi_notificationtemplates", 49 | $options_notif 50 | ); 51 | 52 | foreach ($DB->request([ 53 | 'FROM' => 'glpi_notificationtemplates', 54 | 'WHERE' => $options_notif]) as $data) { 55 | $templates_id = $data['id']; 56 | 57 | if ($templates_id) { 58 | $DB->insert( 59 | "glpi_notificationtemplatetranslations", 60 | [ 61 | 'notificationtemplates_id' => $templates_id, 62 | 'subject' => '##consumable.action## : ##consumable.entity##', 63 | 'content_text' => '##FOREACHconsumabledata## 64 | ##lang.consumable.entity## :##consumable.entity## 65 | ##lang.consumablerequest.requester## : ##consumablerequest.requester## 66 | ##lang.consumablerequest.consumabletype## : ##consumablerequest.consumabletype## 67 | ##lang.consumablerequest.consumable## : ##consumablerequest.consumable## 68 | ##lang.consumablerequest.number## : ##consumablerequest.number## 69 | ##lang.consumablerequest.requestdate## : ##consumablerequest.requestdate## 70 | ##lang.consumablerequest.status## : ##consumablerequest.status## 71 | ##ENDFOREACHconsumabledata##', 72 | 'content_html' => '##FOREACHconsumabledata##<br /> <br /> 73 | <p>##lang.consumable.entity## :##consumable.entity##<br /> <br /> 74 | ##lang.consumablerequest.requester## : ##consumablerequest.requester##<br /> 75 | ##lang.consumablerequest.consumabletype## : ##consumablerequest.consumabletype##<br /> 76 | ##lang.consumablerequest.consumable## : ##consumablerequest.consumable##<br /> 77 | ##lang.consumablerequest.number## : ##consumablerequest.number##<br /> 78 | ##lang.consumablerequest.requestdate## : ##consumablerequest.requestdate##<br /> 79 | ##lang.consumablerequest.status## : ##consumablerequest.status##<br /> 80 | ##ENDFOREACHconsumabledata##', 81 | ] 82 | ); 83 | 84 | $DB->insert( 85 | "glpi_notifications", 86 | [ 87 | 'name' => 'Consumable request', 88 | 'entities_id' => 0, 89 | 'itemtype' => Request::class, 90 | 'event' => 'ConsumableRequest', 91 | 'is_recursive' => 1, 92 | ] 93 | ); 94 | 95 | $options_notif = ['itemtype' => Request::class, 96 | 'name' => 'Consumable request', 97 | 'event' => 'ConsumableRequest']; 98 | 99 | foreach ($DB->request([ 100 | 'FROM' => 'glpi_notifications', 101 | 'WHERE' => $options_notif]) as $data_notif) { 102 | $notification = $data_notif['id']; 103 | if ($notification) { 104 | $DB->insert( 105 | "glpi_notifications_notificationtemplates", 106 | [ 107 | 'notifications_id' => $notification, 108 | 'mode' => 'mailing', 109 | 'notificationtemplates_id' => $templates_id, 110 | ] 111 | ); 112 | } 113 | } 114 | } 115 | } 116 | 117 | // Request validation 118 | $options_notif = ['itemtype' => Request::class, 119 | 'name' => 'Consumables Request Validation']; 120 | // Request 121 | $DB->insert( 122 | "glpi_notificationtemplates", 123 | $options_notif 124 | ); 125 | 126 | foreach ($DB->request([ 127 | 'FROM' => 'glpi_notificationtemplates', 128 | 'WHERE' => $options_notif]) as $data) { 129 | $templates_id = $data['id']; 130 | 131 | if ($templates_id) { 132 | $DB->insert( 133 | "glpi_notificationtemplatetranslations", 134 | [ 135 | 'notificationtemplates_id' => $templates_id, 136 | 'subject' => '##consumable.action## : ##consumable.entity##', 137 | 'content_text' => '##FOREACHconsumabledata## 138 | ##lang.consumable.entity## :##consumable.entity## 139 | ##lang.consumablerequest.requester## : ##consumablerequest.requester## 140 | ##lang.consumablerequest.validator## : ##consumablerequest.validator## 141 | ##lang.consumablerequest.consumabletype## : ##consumablerequest.consumabletype## 142 | ##lang.consumablerequest.consumable## : ##consumablerequest.consumable## 143 | ##lang.consumablerequest.number## : ##consumablerequest.number## 144 | ##lang.consumablerequest.requestdate## : ##consumablerequest.requestdate## 145 | ##lang.consumablerequest.status## : ##consumablerequest.status## 146 | ##ENDFOREACHconsumabledata## 147 | ##lang.consumablerequest.comment## : ##consumablerequest.comment##', 148 | 'content_html' => '##FOREACHconsumabledata##<br /> <br /> 149 | <p>##lang.consumable.entity## :##consumable.entity##<br /> <br /> 150 | ##lang.consumablerequest.requester## : ##consumablerequest.requester##<br /> 151 | ##lang.consumablerequest.validator## : ##consumablerequest.validator##<br /> 152 | ##lang.consumablerequest.consumabletype## : ##consumablerequest.consumabletype##<br /> 153 | ##lang.consumablerequest.consumable## : ##consumablerequest.consumable##<br /> 154 | ##lang.consumablerequest.number## : ##consumablerequest.number##<br /> 155 | ##lang.consumablerequest.requestdate## : ##consumablerequest.requestdate##<br /> 156 | ##lang.consumablerequest.status## : ##consumablerequest.status##<br /> 157 | ##lang.consumablerequest.comment## : ##consumablerequest.comment##<br /> 158 | ##ENDFOREACHconsumabledata##', 159 | ] 160 | ); 161 | 162 | $DB->insert( 163 | "glpi_notifications", 164 | [ 165 | 'name' => 'Consumable request validation', 166 | 'entities_id' => 0, 167 | 'itemtype' => Request::class, 168 | 'event' => 'ConsumableResponse', 169 | 'is_recursive' => 1, 170 | ] 171 | ); 172 | 173 | $options_notif = ['itemtype' => Request::class, 174 | 'name' => 'Consumable request validation', 175 | 'event' => 'ConsumableResponse']; 176 | 177 | foreach ($DB->request([ 178 | 'FROM' => 'glpi_notifications', 179 | 'WHERE' => $options_notif]) as $data_notif) { 180 | $notification = $data_notif['id']; 181 | if ($notification) { 182 | $DB->insert( 183 | "glpi_notifications_notificationtemplates", 184 | [ 185 | 'notifications_id' => $notification, 186 | 'mode' => 'mailing', 187 | 'notificationtemplates_id' => $templates_id, 188 | ] 189 | ); 190 | } 191 | } 192 | } 193 | } 194 | 195 | $migration->executeMigration(); 196 | 197 | return true; 198 | } 199 | -------------------------------------------------------------------------------- /src/NotificationTargetRequest.php: -------------------------------------------------------------------------------- 1 | . 28 | -------------------------------------------------------------------------- 29 | */ 30 | 31 | namespace GlpiPlugin\Consumables; 32 | 33 | use CommonITILValidation; 34 | use ConsumableItem; 35 | use ConsumableItemType; 36 | use Dropdown; 37 | use Glpi\RichText\RichText; 38 | use Group; 39 | use Html; 40 | use NotificationTarget; 41 | use User; 42 | 43 | if (!defined('GLPI_ROOT')) { 44 | die("Sorry. You can't access directly to this file"); 45 | } 46 | 47 | /** 48 | * Class NotificationTargetRequest 49 | */ 50 | class NotificationTargetRequest extends NotificationTarget 51 | { 52 | public const CONSUMABLE_REQUEST = "ConsumableRequest"; 53 | public const CONSUMABLE_RESPONSE = "ConsumableResponse"; 54 | public const VALIDATOR = 30; 55 | public const REQUESTER = 31; 56 | public const RECIPIENT = 32; 57 | 58 | /** 59 | * @return array 60 | */ 61 | public function getEvents() 62 | { 63 | return [ 64 | self::CONSUMABLE_REQUEST => __('Consumable request', 'consumables'), 65 | self::CONSUMABLE_RESPONSE => __('Consumable validation', 'consumables'), 66 | ]; 67 | } 68 | 69 | public function validateSendTo($event, array $infos, $notify_me = false, $emitter = null) 70 | { 71 | // Always send notification for satisfaction : if send on ticket closure 72 | // Always send notification for new ticket 73 | if (in_array($event, ['ConsumableRequest', 'ConsumableResponse'])) { 74 | return true; 75 | } 76 | 77 | return parent::validateSendTo($event, $infos, $notify_me, $emitter); 78 | } 79 | 80 | /** 81 | * @param $event 82 | * @param array $options 83 | */ 84 | public function addDataForTemplate($event, $options = []) 85 | { 86 | // Set labels 87 | $this->data['##lang.consumable.entity##'] = __('Entity'); 88 | $this->data['##lang.consumable.id##'] = __('Consumable ID', 'consumables'); 89 | switch ($event) { 90 | case self::CONSUMABLE_REQUEST: 91 | $this->data['##consumable.action##'] = __('Consumable request', 'consumables'); 92 | break; 93 | case self::CONSUMABLE_RESPONSE: 94 | $this->data['##consumable.action##'] = __('Consumable validation', 'consumables'); 95 | break; 96 | } 97 | $this->data['##lang.consumablerequest.consumable##'] = _n('Consumable', 'Consumables', 1); 98 | $this->data['##lang.consumablerequest.consumabletype##'] = _n('Consumable type', 'Consumable types', 1); 99 | $this->data['##lang.consumablerequest.requestdate##'] = __('Request date'); 100 | $this->data['##lang.consumablerequest.requester##'] = __('Requester'); 101 | $this->data['##lang.consumablerequest.giveto##'] = __("Give to"); 102 | $this->data['##lang.consumablerequest.status##'] = __('Status'); 103 | $this->data['##lang.consumablerequest.number##'] = __('Number of used consumables'); 104 | $this->data['##lang.consumablerequest.validator##'] = __('Approver'); 105 | $this->data['##lang.consumablerequest.comment##'] = __('Comments'); 106 | 107 | $this->data['##consumable.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']); 108 | //Set values 109 | // foreach ($options['consumables'] as $id => $item) { 110 | $tmp = []; 111 | $tmp['##consumable.id##'] = $options['consumables']['consumableitems_id']; 112 | $tmp['##consumablerequest.consumable##'] = Dropdown::getDropdownName( 113 | ConsumableItem::getTable(), 114 | $options['consumables']['consumableitems_id'] 115 | ); 116 | $tmp['##consumablerequest.consumabletype##'] = Dropdown::getDropdownName( 117 | ConsumableItemType::getTable(), 118 | $options['consumables']['consumableitemtypes_id'] 119 | ); 120 | $tmp['##consumablerequest.requestdate##'] = Html::convDateTime($options['consumables']['date_mod']); 121 | if (isset($item['end_date'])) { 122 | $tmp['##consumablerequest.enddate##'] = Html::convDateTime($options['consumables']['enddate']); 123 | } 124 | 125 | $give_to_id = $options['consumables']['give_items_id']; 126 | $give_to_item = $options['consumables']['give_itemtype']; 127 | if ($give_to_item == 'User') { 128 | $give_to = getUserName($give_to_id); 129 | } else { 130 | $group = new Group(); 131 | $group->getFromDB($give_to_id); 132 | $give_to = $group->getField('name'); 133 | } 134 | $tmp['##consumablerequest.requester##'] = getUserName($options['consumables']['requesters_id']); 135 | $tmp['##consumablerequest.giveto##'] = $give_to; 136 | $tmp['##consumablerequest.validator##'] = getUserName($options['consumables']['validators_id']); 137 | $tmp['##consumablerequest.number##'] = $options['consumables']['number']; 138 | $tmp['##consumablerequest.status##'] = CommonITILValidation::getStatus($options['consumables']['status']); 139 | 140 | $this->data['consumabledata'][] = $tmp; 141 | // } 142 | if (isset($options['comment'])) { 143 | $this->data['##consumablerequest.comment##'] = RichText::getSafeHtml($options['comment']); 144 | } 145 | } 146 | 147 | /** 148 | * 149 | */ 150 | public function getTags() 151 | { 152 | $tags = [ 153 | 'consumable.id' => __('Consumable ID', 'consumables'), 154 | 'consumable.action' => __('Type of event', 'consumables'), 155 | 'consumable.entity' => __('Entity'), 156 | 'consumablerequest.consumable' => _n('Consumable', 'Consumables', 1), 157 | 'consumablerequest.consumabletype' => _n('Consumable type', 'Consumable types', 1), 158 | 'consumablerequest.requestdate' => __('Request date'), 159 | 'consumablerequest.enddate' => __('End date'), 160 | 'consumablerequest.requester' => __('Requester'), 161 | 'consumablerequest.giveto' => __('Give to'), 162 | 'consumablerequest.status' => __('Status'), 163 | 'consumablerequest.number' => __('Number of used consumables'), 164 | 'consumablerequest.validator' => __('Approver'), 165 | 'consumablerequest.comment' => __('Comments'), 166 | ]; 167 | 168 | foreach ($tags as $tag => $label) { 169 | $this->addTagToList([ 170 | 'tag' => $tag, 171 | 'label' => $label, 172 | 'lang' => true, 173 | 'value' => true, 174 | ]); 175 | } 176 | 177 | $this->addTagToList([ 178 | 'tag' => 'consumabledata', 179 | 'label' => __('Display each consumable', 'consumables'), 180 | 'lang' => true, 181 | 'foreach' => true, 182 | 'value' => true, 183 | ]); 184 | 185 | asort($this->tag_descriptions); 186 | } 187 | 188 | /** 189 | * Get additionnals targets for Tickets 190 | * 191 | * @param string $event 192 | */ 193 | public function addAdditionalTargets($event = '') 194 | { 195 | $this->addTarget(self::VALIDATOR, __("Consumable approver", "consumables")); 196 | $this->addTarget(self::REQUESTER, __("Consumable requester", "consumables")); 197 | $this->addTarget(self::RECIPIENT, __("Consumable recipient", "consumables")); 198 | } 199 | 200 | /** 201 | * @param $data 202 | * @param $options 203 | */ 204 | public function addSpecificTargets($data, $options) 205 | { 206 | switch ($data['items_id']) { 207 | case self::VALIDATOR: 208 | $this->addUserByField("validators_id"); 209 | break; 210 | case self::REQUESTER: 211 | $this->addUserByField("requesters_id"); 212 | break; 213 | case self::RECIPIENT: 214 | $this->addUserByRecipient(); 215 | break; 216 | } 217 | } 218 | 219 | public function addUserByRecipient() 220 | { 221 | $type = $this->obj->getField("give_itemtype"); 222 | 223 | if ($type == User::getType()) { 224 | $this->addUserByField("give_items_id"); 225 | } elseif ($type == Group::getType()) { 226 | $id = $this->obj->getField("give_items_id"); 227 | $this->addForGroup(0, $id); 228 | } 229 | } 230 | 231 | } 232 | -------------------------------------------------------------------------------- /src/Profile.php: -------------------------------------------------------------------------------- 1 | . 28 | -------------------------------------------------------------------------- 29 | */ 30 | 31 | namespace GlpiPlugin\Consumables; 32 | 33 | use CommonGLPI; 34 | use DbUtils; 35 | use Html; 36 | use ProfileRight; 37 | use Session; 38 | 39 | if (!defined('GLPI_ROOT')) { 40 | die("Sorry. You can't access directly to this file"); 41 | } 42 | 43 | /** 44 | * Class Profile 45 | */ 46 | class Profile extends \Profile 47 | { 48 | /** 49 | * @param CommonGLPI $item 50 | * @param int $withtemplate 51 | * 52 | * @return string|translated 53 | */ 54 | public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) 55 | { 56 | if ($item->getType() == 'Profile') { 57 | return self::createTabEntry(Menu::getMenuName()); 58 | } 59 | return ''; 60 | } 61 | 62 | public static function getIcon() 63 | { 64 | return Request::getIcon(); 65 | } 66 | 67 | /** 68 | * @param CommonGLPI $item 69 | * @param int $tabnum 70 | * @param int $withtemplate 71 | * 72 | * @return bool 73 | */ 74 | public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) 75 | { 76 | if ($item->getType() == 'Profile') { 77 | $ID = $item->getID(); 78 | $prof = new self(); 79 | 80 | self::addDefaultProfileInfos($ID, ['plugin_consumables' => 0, 81 | 'plugin_consumables_request' => 0, 82 | 'plugin_consumables_user' => 0, 83 | 'plugin_consumables_group' => 0, 84 | 'plugin_consumables_validation' => 0]); 85 | $prof->showForm($ID); 86 | } 87 | 88 | return true; 89 | } 90 | 91 | /** 92 | * @param $ID 93 | */ 94 | public static function createFirstAccess($ID) 95 | { 96 | //85 97 | self::addDefaultProfileInfos( 98 | $ID, 99 | ['plugin_consumables' => ALLSTANDARDRIGHT, 100 | 'plugin_consumables_request' => 1, 101 | 'plugin_consumables_user' => 1, 102 | 'plugin_consumables_group' => 1, 103 | 'plugin_consumables_validation' => 1], 104 | true 105 | ); 106 | } 107 | 108 | /** 109 | * @param $profiles_id 110 | * @param $rights 111 | * @param bool $drop_existing 112 | * 113 | * @internal param $profile 114 | */ 115 | public static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) 116 | { 117 | $dbu = new DbUtils(); 118 | $profileRight = new ProfileRight(); 119 | foreach ($rights as $right => $value) { 120 | if ($dbu->countElementsInTable( 121 | 'glpi_profilerights', 122 | ["profiles_id" => $profiles_id, "name" => $right] 123 | ) && $drop_existing) { 124 | $profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]); 125 | } 126 | if (!$dbu->countElementsInTable( 127 | 'glpi_profilerights', 128 | ["profiles_id" => $profiles_id, "name" => $right] 129 | )) { 130 | $myright['profiles_id'] = $profiles_id; 131 | $myright['name'] = $right; 132 | $myright['rights'] = $value; 133 | $profileRight->add($myright); 134 | 135 | //Add right to the current session 136 | $_SESSION['glpiactiveprofile'][$right] = $value; 137 | } 138 | } 139 | } 140 | 141 | /** 142 | * Show profile form 143 | * 144 | * @param int $profiles_id 145 | * @param array $options 146 | * 147 | * @return nothing 148 | * @internal param int $items_id id of the profile 149 | * @internal param value $target url of target 150 | */ 151 | public function showForm($profiles_id = 0, $openform = true, $closeform = true) 152 | { 153 | $profile = new \Profile(); 154 | echo "
"; 155 | if (($canedit = Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, PURGE])) && $openform) { 156 | echo "
"; 157 | } 158 | 159 | $profile->getFromDB($profiles_id); 160 | 161 | $rights = $this->getAllRights(); 162 | $profile->displayRightsChoiceMatrix($rights, ['default_class' => 'tab_bg_2', 163 | 'title' => __('General')]); 164 | 165 | echo ""; 166 | echo "\n"; 167 | 168 | $effective_rights = ProfileRight::getProfileRights($profiles_id, ['plugin_consumables_user', 169 | 'plugin_consumables_group', 170 | 'plugin_consumables_validation', 171 | 'plugin_consumables_request']); 172 | 173 | echo ""; 174 | echo ""; 175 | echo ""; 179 | echo ""; 183 | echo "\n"; 184 | 185 | echo ""; 186 | echo ""; 187 | echo ""; 191 | echo ""; 192 | echo ""; 196 | echo "\n"; 197 | echo "
" . __('Advanced', 'consumables') . "
" . __('Consumable validation', 'consumables') . ""; 176 | Html::showCheckbox(['name' => '_plugin_consumables_validation[1_0]', 177 | 'checked' => $effective_rights['plugin_consumables_validation']]); 178 | echo "" . __('Make a consumable request', 'consumables') . ""; 180 | Html::showCheckbox(['name' => '_plugin_consumables_request[1_0]', 181 | 'checked' => $effective_rights['plugin_consumables_request']]); 182 | echo "
" . __('Make a consumable request for all users', 'consumables') . ""; 188 | Html::showCheckbox(['name' => '_plugin_consumables_user[1_0]', 189 | 'checked' => $effective_rights['plugin_consumables_user']]); 190 | echo "" . __('Make a consumable request for my groups', 'consumables') . ""; 193 | Html::showCheckbox(['name' => '_plugin_consumables_group[1_0]', 194 | 'checked' => $effective_rights['plugin_consumables_group']]); 195 | echo "
"; 198 | if ($canedit && $closeform) { 199 | echo "
"; 200 | echo Html::hidden('id', ['value' => $profiles_id]); 201 | echo Html::submit(_sx('button', 'Save'), ['name' => 'update', 'class' => 'btn btn-primary']); 202 | echo "
\n"; 203 | Html::closeForm(); 204 | } 205 | 206 | echo "
"; 207 | } 208 | 209 | /** 210 | * @param bool $all 211 | * 212 | * @return array 213 | */ 214 | public static function getAllRights($all = false) 215 | { 216 | $rights = [ 217 | ['itemtype' => Request::class, 218 | 'label' => _n('Consumable', 'Consumables', 2, 'consumables'), 219 | 'field' => 'plugin_consumables', 220 | ], 221 | ]; 222 | 223 | if ($all) { 224 | $rights[] = ['itemtype' => Request::class, 225 | 'label' => __('Make a consumable request for users', 'consumables'), 226 | 'field' => 'plugin_consumables_user']; 227 | 228 | $rights[] = ['itemtype' => Request::class, 229 | 'label' => __('Make a consumable request', 'consumables'), 230 | 'field' => 'plugin_consumables_request']; 231 | 232 | $rights[] = ['itemtype' => Request::class, 233 | 'label' => __('Make a consumable request for groups', 'consumables'), 234 | 'field' => 'plugin_consumables_group']; 235 | 236 | $rights[] = ['itemtype' => Request::class, 237 | 'label' => __('Consumable validation', 'consumables'), 238 | 'field' => 'plugin_consumables_validation']; 239 | } 240 | 241 | return $rights; 242 | } 243 | 244 | /** 245 | * Init profiles 246 | * 247 | * @param $old_right 248 | * 249 | * @return int 250 | */ 251 | 252 | public static function translateARight($old_right) 253 | { 254 | switch ($old_right) { 255 | case '': 256 | return 0; 257 | case 'r': 258 | return READ; 259 | case 'w': 260 | return ALLSTANDARDRIGHT + READNOTE + UPDATENOTE; 261 | case '0': 262 | case '1': 263 | return $old_right; 264 | 265 | default: 266 | return 0; 267 | } 268 | } 269 | 270 | /** 271 | * @since 0.85 272 | * Migration rights from old system to the new one for one profile 273 | * 274 | * @param $profiles_id 275 | * 276 | * @return bool 277 | */ 278 | public static function migrateOneProfile($profiles_id) 279 | { 280 | global $DB; 281 | //Cannot launch migration if there's nothing to migrate... 282 | if (!$DB->tableExists('glpi_plugin_consumables_profiles')) { 283 | return true; 284 | } 285 | 286 | $it = $DB->request([ 287 | 'FROM' => 'glpi_plugin_consumables_profiles', 288 | 'WHERE' => ['profiles_id' => $profiles_id], 289 | ]); 290 | foreach ($it as $profile_data) { 291 | $matching = ['consumables' => 'plugin_consumables', 292 | 'user' => 'plugin_consumables_user', 293 | 'request' => 'plugin_consumables_request', 294 | 'group' => 'plugin_consumables_group', 295 | 'validation' => 'plugin_consumables_validation']; 296 | $current_rights = ProfileRight::getProfileRights($profiles_id, array_values($matching)); 297 | foreach ($matching as $old => $new) { 298 | if (!isset($current_rights[$old])) { 299 | $DB->update('glpi_profilerights', ['rights' => self::translateARight($profile_data[$old])], [ 300 | 'name' => $new, 301 | 'profiles_id' => $profiles_id, 302 | ]); 303 | } 304 | } 305 | } 306 | } 307 | 308 | /** 309 | * Initialize profiles, and migrate it necessary 310 | */ 311 | public static function initProfile() 312 | { 313 | global $DB; 314 | $profile = new self(); 315 | $dbu = new DbUtils(); 316 | //Add new rights in glpi_profilerights table 317 | foreach ($profile->getAllRights(true) as $data) { 318 | if ($dbu->countElementsInTable( 319 | "glpi_profilerights", 320 | ["name" => $data['field']] 321 | ) == 0) { 322 | ProfileRight::addProfileRights([$data['field']]); 323 | } 324 | } 325 | 326 | //Migration old rights in new ones 327 | $it = $DB->request([ 328 | 'SELECT' => ['id'], 329 | 'FROM' => 'glpi_profiles', 330 | ]); 331 | foreach ($it as $prof) { 332 | self::migrateOneProfile($prof['id']); 333 | } 334 | $it = $DB->request([ 335 | 'FROM' => 'glpi_profilerights', 336 | 'WHERE' => [ 337 | 'profiles_id' => $_SESSION['glpiactiveprofile']['id'], 338 | 'name' => ['LIKE', '%plugin_consumables%'], 339 | ], 340 | ]); 341 | foreach ($it as $prof) { 342 | if (isset($_SESSION['glpiactiveprofile'])) { 343 | $_SESSION['glpiactiveprofile'][$prof['name']] = $prof['rights']; 344 | } 345 | } 346 | } 347 | 348 | 349 | public static function removeRightsFromSession() 350 | { 351 | foreach (self::getAllRights(true) as $right) { 352 | if (isset($_SESSION['glpiactiveprofile'][$right['field']])) { 353 | unset($_SESSION['glpiactiveprofile'][$right['field']]); 354 | } 355 | } 356 | } 357 | } 358 | --------------------------------------------------------------------------------