├── locales
├── en_GB.mo
├── es_EC.mo
├── es_ES.mo
├── fr_CA.mo
├── fr_FR.mo
├── it_IT.mo
├── pt_BR.mo
├── pt_PT.mo
└── ru_RU.mo
├── wiki
├── demo_cri.png
├── followup.png
├── monthly.png
├── Liste_cri.png
├── contracts.png
└── administrative_data.png
├── manageentities.png
├── public
├── pics
│ ├── tag.png
│ ├── logo.jpg
│ ├── asterisk.png
│ └── database_save.png
├── lib
│ ├── echarts
│ │ ├── echarts.js
│ │ └── theme
│ │ │ ├── vintage.js
│ │ │ ├── tool
│ │ │ ├── thumb.js
│ │ │ ├── thumb.html
│ │ │ └── option
│ │ │ │ ├── area.js
│ │ │ │ ├── pie.js
│ │ │ │ └── bar.js
│ │ │ ├── roma.js
│ │ │ ├── sakura.js
│ │ │ ├── mint.js
│ │ │ └── dark-blue.js
│ ├── jquery-gantt
│ │ └── img
│ │ │ ├── green.png
│ │ │ ├── grey.png
│ │ │ ├── grid.png
│ │ │ ├── red.png
│ │ │ ├── white.png
│ │ │ ├── buttons.png
│ │ │ ├── orange.png
│ │ │ ├── loader-bg.png
│ │ │ ├── icon_sprite.png
│ │ │ ├── star_sprite.png
│ │ │ └── slider_handle.png
│ ├── jquery-plugins
│ │ └── img
│ │ │ ├── red.png
│ │ │ ├── green.png
│ │ │ ├── grey.png
│ │ │ ├── grid.png
│ │ │ ├── white.png
│ │ │ ├── buttons.png
│ │ │ ├── orange.png
│ │ │ ├── loader-bg.png
│ │ │ ├── icon_sprite.png
│ │ │ ├── slider_handle.png
│ │ │ └── star_sprite.png
│ └── jquery-ui
│ │ └── images
│ │ ├── ui-icons_444444_256x240.png
│ │ ├── ui-icons_555555_256x240.png
│ │ ├── ui-icons_777620_256x240.png
│ │ ├── ui-icons_777777_256x240.png
│ │ ├── ui-icons_cc0000_256x240.png
│ │ └── ui-icons_ffffff_256x240.png
└── scripts
│ ├── manageentities_load_scripts.js
│ └── script-directhelpdesk.js.php
├── install
├── sql
│ ├── update-2.0.1.sql
│ ├── update-3.2.2.sql
│ ├── update-4.0.0.sql
│ ├── update-1.9.2.sql
│ ├── update-4.1.4.sql
│ ├── update-1.5.1.sql
│ ├── update-2.0.0.sql
│ ├── update-2.1.3.sql
│ ├── update-1.4.sql
│ ├── update-2.1.4.sql
│ ├── update-1.9.1.sql
│ ├── update-4.1.3.sql
│ ├── update-3.2.1.sql
│ ├── update-2.0.2.sql
│ ├── update-4.0.4.sql
│ ├── empty-1.3.sql
│ ├── empty-1.4.sql
│ ├── update-1.9.0.sql
│ ├── update-1.5.0.sql
│ ├── empty-1.5.0.sql
│ └── empty-1.5.1.sql
├── index.php
├── update_211_212.php
├── update_214_215.php
└── update_210_211.php
├── composer.json
├── tools
├── update_mo.pl
├── update_po.pl
└── extract_template.sh
├── .github
└── workflows
│ ├── updatepot.yml
│ ├── generatemo.yml
│ └── release.yml
├── index.php
├── ajax
├── index.php
├── getUserTechName.php
├── dropdownCustomer.php
├── criprice.php
├── showalertbyentity.php
├── directhelpdesk.php
├── taskend.php
├── viewsubitem.php
├── loadscripts.php
├── dropdownGenerateCriCategories.php
├── linkactions.php
├── dropdownContract.php
├── getDropdownNumber.php
├── tickettask.php
├── entity.tabs.php
└── updateDocumentList.php
├── front
├── index.php
├── preference.form.php
├── taskcategory.form.php
├── addelements.listener.php
├── company.php
├── contractday.php
├── entity.form.php
├── addelements.form.php
├── company.form.php
├── criprice.form.php
├── cridetail.form.php
├── generatecri.php
├── cri.send.php
├── config.form.php
├── contract.form.php
├── cri.form.php
├── contractday.form.php
├── directhelpdesk.php
├── generatecri.form.php
└── directhelpdesk.form.php
├── README.md
└── src
├── Servicecatalog.php
├── TicketTask.php
├── DirectHelpdeskInjection.php
├── Dropdown.php
├── ContractState.php
├── CriType.php
└── TaskCategory.php
/locales/en_GB.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/en_GB.mo
--------------------------------------------------------------------------------
/locales/es_EC.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/es_EC.mo
--------------------------------------------------------------------------------
/locales/es_ES.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/es_ES.mo
--------------------------------------------------------------------------------
/locales/fr_CA.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/fr_CA.mo
--------------------------------------------------------------------------------
/locales/fr_FR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/fr_FR.mo
--------------------------------------------------------------------------------
/locales/it_IT.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/it_IT.mo
--------------------------------------------------------------------------------
/locales/pt_BR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/pt_BR.mo
--------------------------------------------------------------------------------
/locales/pt_PT.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/pt_PT.mo
--------------------------------------------------------------------------------
/locales/ru_RU.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/locales/ru_RU.mo
--------------------------------------------------------------------------------
/wiki/demo_cri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/wiki/demo_cri.png
--------------------------------------------------------------------------------
/wiki/followup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/wiki/followup.png
--------------------------------------------------------------------------------
/wiki/monthly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/wiki/monthly.png
--------------------------------------------------------------------------------
/manageentities.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/manageentities.png
--------------------------------------------------------------------------------
/public/pics/tag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/pics/tag.png
--------------------------------------------------------------------------------
/wiki/Liste_cri.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/wiki/Liste_cri.png
--------------------------------------------------------------------------------
/wiki/contracts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/wiki/contracts.png
--------------------------------------------------------------------------------
/public/pics/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/pics/logo.jpg
--------------------------------------------------------------------------------
/public/pics/asterisk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/pics/asterisk.png
--------------------------------------------------------------------------------
/install/sql/update-2.0.1.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `company_address` TEXT default NULL;
2 |
--------------------------------------------------------------------------------
/public/lib/echarts/echarts.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/echarts/echarts.js
--------------------------------------------------------------------------------
/public/pics/database_save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/pics/database_save.png
--------------------------------------------------------------------------------
/wiki/administrative_data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/wiki/administrative_data.png
--------------------------------------------------------------------------------
/install/sql/update-3.2.2.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `disable_date_header` tinyint(1) NOT NULL default '0';
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/green.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/grey.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/grid.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/red.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/white.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/red.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/buttons.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/orange.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/green.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/grey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/grey.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/grid.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/white.png
--------------------------------------------------------------------------------
/install/sql/update-4.0.0.sql:
--------------------------------------------------------------------------------
1 | UPDATE `glpi_plugin_manageentities_configs` SET `documentcategories_id` = '0' WHERE `documentcategories_id` = '-1';
2 |
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/loader-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/loader-bg.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/buttons.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/orange.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/icon_sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/icon_sprite.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/star_sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/star_sprite.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/loader-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/loader-bg.png
--------------------------------------------------------------------------------
/public/lib/jquery-gantt/img/slider_handle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-gantt/img/slider_handle.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/icon_sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/icon_sprite.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/slider_handle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/slider_handle.png
--------------------------------------------------------------------------------
/public/lib/jquery-plugins/img/star_sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-plugins/img/star_sprite.png
--------------------------------------------------------------------------------
/install/sql/update-1.9.2.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_cridetails`
2 | ADD `plugin_manageentities_contractdays_id` int(11) NOT NULL default '0';
3 |
--------------------------------------------------------------------------------
/install/sql/update-4.1.4.sql:
--------------------------------------------------------------------------------
1 | UPDATE `glpi_documents_items` SET `itemtype` = 'GlpiPlugin\\Manageentities\\Company' WHERE `itemtype` = 'PluginManageentitiesCompany';
2 |
--------------------------------------------------------------------------------
/public/lib/jquery-ui/images/ui-icons_444444_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-ui/images/ui-icons_444444_256x240.png
--------------------------------------------------------------------------------
/public/lib/jquery-ui/images/ui-icons_555555_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-ui/images/ui-icons_555555_256x240.png
--------------------------------------------------------------------------------
/public/lib/jquery-ui/images/ui-icons_777620_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-ui/images/ui-icons_777620_256x240.png
--------------------------------------------------------------------------------
/public/lib/jquery-ui/images/ui-icons_777777_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-ui/images/ui-icons_777777_256x240.png
--------------------------------------------------------------------------------
/public/lib/jquery-ui/images/ui-icons_cc0000_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-ui/images/ui-icons_cc0000_256x240.png
--------------------------------------------------------------------------------
/public/lib/jquery-ui/images/ui-icons_ffffff_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/InfotelGLPI/manageentities/master/public/lib/jquery-ui/images/ui-icons_ffffff_256x240.png
--------------------------------------------------------------------------------
/install/sql/update-1.5.1.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentity_config` ADD `hourbyday` INT( 11 ) NOT NULL;
2 | UPDATE `glpi_plugin_manageentity_config` SET `hourbyday`='8' WHERE `ID` = '1';
--------------------------------------------------------------------------------
/install/sql/update-2.0.0.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_configs` DROP `linktocontract`;
2 | ALTER TABLE `glpi_plugin_manageentities_contractstates` ADD `color` VARCHAR(7) default '#F2F2F2';
3 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "minimum-stability": "dev",
3 | "prefer-stable": true,
4 | "require-dev": {
5 | "glpi-project/tools": "^0.4"
6 | },
7 | "require": {
8 | "fpdf/fpdf": "^1.83.2"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/install/sql/update-2.1.3.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `comment` tinyint(1) NOT NULL default '1' COMMENT 'display comments in the CRI';
2 | ALTER TABLE `glpi_plugin_manageentities_companies` ADD `comment` text collate utf8_unicode_ci;
3 |
--------------------------------------------------------------------------------
/install/sql/update-1.4.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_preference`;
2 | CREATE TABLE `glpi_plugin_manageentity_preference` (
3 | `ID` int(11) NOT NULL auto_increment,
4 | `user_id` int(11) NOT NULL,
5 | `show` varchar(255) NOT NULL,
6 | PRIMARY KEY (`ID`)
7 | ) ENGINE=MyISAM;
--------------------------------------------------------------------------------
/install/sql/update-2.1.4.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_contracts` ADD `moving_management` tinyint(1) NOT NULL DEFAULT '0';
2 | ALTER TABLE `glpi_plugin_manageentities_contracts` ADD `duration_moving` decimal(20,2) NOT NULL default '0';
3 | ALTER TABLE `glpi_plugin_manageentities_cridetails` ADD `number_moving` int(11) NOT NULL default '0' COMMENT 'Number of movements';
4 |
--------------------------------------------------------------------------------
/install/sql/update-1.9.1.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_configs`
2 | ADD `linktocontract` tinyint(1) NOT NULL default '0' COMMENT 'default for no';
3 |
4 | ALTER TABLE `glpi_plugin_manageentities_contracts`
5 | ADD `contract_added` tinyint(1) NOT NULL default '0';
6 |
7 | ALTER TABLE `glpi_plugin_manageentities_contractstates`
8 | ADD `is_closed` tinyint(1) NOT NULL default '0';
9 |
--------------------------------------------------------------------------------
/install/sql/update-4.1.3.sql:
--------------------------------------------------------------------------------
1 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Manageentities\\Directhelpdesk' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginManageentitiesDirecthelpdesk';
2 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Manageentities\\Contractday' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginManageentitiesContractday';
3 | UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Manageentities\\CriType' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginManageentitiesCriType';
4 |
--------------------------------------------------------------------------------
/install/sql/update-3.2.1.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `non_accomplished_tasks` tinyint(1) NOT NULL default '0';
2 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `get_pdf_cri` tinyint(1) NOT NULL default '0';
3 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `ticket_state` int(11) NOT NULL default '3';
4 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `default_duration` varchar(255) default NULL;
5 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `default_time_am` varchar(255) default NULL;
6 | ALTER TABLE `glpi_plugin_manageentities_configs` ADD `default_time_pm` varchar(255) default NULL;
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/install/sql/update-2.0.2.sql:
--------------------------------------------------------------------------------
1 |
2 | DROP TABLE IF EXISTS `glpi_plugin_manageentities_interventionskateholders`;
3 | CREATE TABLE `glpi_plugin_manageentities_interventionskateholders` (
4 | `id` int(11) NOT NULL auto_increment,
5 | `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)',
6 | `number_affected_days` double NOT NULL default '0' COMMENT 'Number of days affected to the user to an intervention',
7 | `plugin_manageentities_contractdays_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_manageentities_contractdays (id)',
8 | PRIMARY KEY (`id`)
9 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
10 |
11 | ALTER TABLE `glpi_plugin_manageentities_contracts` ADD `show_on_global_gantt` tinyint(1) NOT NULL DEFAULT '0';
12 | ALTER TABLE `glpi_plugin_manageentities_contractdays` ADD `charged` tinyint(1) NOT NULL DEFAULT '0';
13 |
--------------------------------------------------------------------------------
/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_manageentities/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 |
--------------------------------------------------------------------------------
/install/index.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
--------------------------------------------------------------------------------
/public/scripts/manageentities_load_scripts.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * Load plugin scripts on page start
4 | */
5 | // (function ($) {
6 | // $.fn.manageentities_load_scripts = function () {
7 | //
8 | // init();
9 | //
10 | // // Start the plugin
11 | // function init() {
12 | // // $(document).ready(function () {
13 | // var path = 'plugins/manageentities/';
14 | // var url = window.location.href.replace(/front\/.*/, path);
15 | // if (window.location.href.indexOf('plugins') > 0) {
16 | // url = window.location.href.replace(/plugins\/.*/, path);
17 | // }
18 | //
19 | // // Send data
20 | // $.ajax({
21 | // url: url + 'ajax/loadscripts.php',
22 | // type: "POST",
23 | // dataType: "html",
24 | // data: 'action=load',
25 | // success: function (response, opts) {
26 | // var scripts, scriptsFinder = /";
45 | // }
46 | // break;
47 | // }
48 | //}
49 |
--------------------------------------------------------------------------------
/front/company.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\Company;
31 | use GlpiPlugin\Manageentities\Entity;
32 |
33 | $company = new Company();
34 |
35 | if (isset($_POST["add"])) {
36 | $company->check(-1, CREATE);
37 | $newID = $company->add($_POST);
38 | if ($_SESSION['glpibackcreated']) {
39 | Html::redirect($company->getFormURL() . "?id=" . $newID);
40 | }
41 | Html::back();
42 | } else if (isset($_POST["update"])) {
43 | $company->check($_POST["id"], UPDATE);
44 | $company->update($_POST);
45 | Html::back();
46 | } else if (isset($_POST["purge"])) {
47 | $company_id = $_POST["id"];
48 | $company->check($_POST["id"], PURGE);
49 | $company->delete($_POST, 1);
50 | $company->redirectToList();
51 | } else {
52 | Html::header(Company::getTypeName(2), '', "management", Entity::class, "company");
53 | $company->display($_GET);
54 | Html::footer();
55 | }
56 |
--------------------------------------------------------------------------------
/front/criprice.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 |
31 | use GlpiPlugin\Manageentities\CriPrice;
32 |
33 | if (Session::haveRight("plugin_manageentities", UPDATE)) {
34 | $criprice = new CriPrice();
35 |
36 | if (isset($_POST["add"])) {
37 | Session::checkRight("contract", CREATE);
38 | $criprice->add($_POST);
39 |
40 | Html::back();
41 |
42 | } elseif (isset($_POST["update"])) {
43 | $criprice->check($_POST["id"], UPDATE);
44 | $criprice->update($_POST);
45 |
46 | Html::back();
47 |
48 | } elseif (isset($_POST["delete"])) {
49 | Session::checkRight("contract", DELETE);
50 | $criprice->delete($_POST, 1);
51 |
52 | Html::back();
53 | }
54 |
55 | } else {
56 | Html::header(__('Setup'), '', "config", "plugin");
57 | echo "
";
58 | echo "" . __("You don't have permission to perform this action.") . "
";
59 | Html::footer();
60 | }
61 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/vintage.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | (function(root, factory) {
21 | if (typeof define === 'function' && define.amd) {
22 | // AMD. Register as an anonymous module.
23 | define(['exports', 'echarts'], factory);
24 | } else if (
25 | typeof exports === 'object' &&
26 | typeof exports.nodeName !== 'string'
27 | ) {
28 | // CommonJS
29 | factory(exports, require('echarts/lib/echarts'));
30 | } else {
31 | // Browser globals
32 | factory({}, root.echarts);
33 | }
34 | })(this, function(exports, echarts) {
35 | var log = function(msg) {
36 | if (typeof console !== 'undefined') {
37 | console && console.error && console.error(msg);
38 | }
39 | };
40 | if (!echarts) {
41 | log('ECharts is not Loaded');
42 | return;
43 | }
44 | var colorPalette = [
45 | '#d87c7c',
46 | '#919e8b',
47 | '#d7ab82',
48 | '#6e7074',
49 | '#61a0a8',
50 | '#efa18d',
51 | '#787464',
52 | '#cc7e63',
53 | '#724e58',
54 | '#4b565b'
55 | ];
56 | echarts.registerTheme('vintage', {
57 | color: colorPalette,
58 | backgroundColor: '#fef8ef',
59 | graph: {
60 | color: colorPalette
61 | }
62 | });
63 | });
64 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/tool/thumb.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | const glob = require('glob');
21 | const puppeteer = require('puppeteer');
22 | const fs = require('fs');
23 | const path = require('path');
24 |
25 | async function wait(time) {
26 | return new Promise(resolve => {
27 | setTimeout(resolve, time);
28 | });
29 | }
30 |
31 | async function snapshot(browser, themePath) {
32 | let themeName = path.basename(themePath, '.js');
33 | let code = fs.readFileSync(themePath, 'utf-8');
34 |
35 | let page = await browser.newPage();
36 | await page.evaluateOnNewDocument(code);
37 | await page.setViewport({ width: 1200, height: 1200 });
38 | try {
39 | await page.goto('http://localhost/echarts/theme/tool/thumb.html#' + themeName);
40 | await wait(200);
41 | await page.screenshot({ path: __dirname + '/../thumb/' + themeName + '.png' });
42 | }
43 | catch (e) {
44 | console.log(e);
45 | }
46 | await page.close();
47 |
48 | console.log('Updated ' + themeName);
49 | }
50 |
51 | glob('../*.js', async function (err, themePathList) {
52 |
53 | let browser = await puppeteer.launch();
54 | for (let themePath of themePathList) {
55 | try {
56 | await snapshot(browser, themePath);
57 | }
58 | catch(e) {
59 | console.log(e);
60 | }
61 | }
62 | await browser.close();
63 | });
--------------------------------------------------------------------------------
/install/sql/empty-1.4.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_contracts`;
2 | CREATE TABLE `glpi_plugin_manageentity_contracts` (
3 | `ID` int(11) NOT NULL auto_increment,
4 | `FK_contracts` int(11) NOT NULL default '0',
5 | `FK_entity` int(11) NOT NULL default '0',
6 | PRIMARY KEY (`ID`),
7 | UNIQUE KEY `FK_contracts` (`FK_contracts`,`FK_entity`),
8 | KEY `FK_contracts_2` (`FK_contracts`),
9 | KEY `FK_entity` (`FK_entity`)
10 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
11 |
12 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_documents`;
13 | CREATE TABLE `glpi_plugin_manageentity_documents` (
14 | `ID` int(11) NOT NULL auto_increment,
15 | `FK_documents` int(11) NOT NULL default '0',
16 | `FK_entity` int(11) NOT NULL default '0',
17 | PRIMARY KEY (`ID`),
18 | UNIQUE KEY `FK_documents` (`FK_documents`,`FK_entity`),
19 | KEY `FK_documents_2` (`FK_documents`),
20 | KEY `FK_entity` (`FK_entity`)
21 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
22 |
23 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_contacts`;
24 | CREATE TABLE `glpi_plugin_manageentity_contacts` (
25 | `ID` int(11) NOT NULL auto_increment,
26 | `FK_contacts` int(11) NOT NULL default '0',
27 | `FK_entity` int(11) NOT NULL default '0',
28 | PRIMARY KEY (`ID`),
29 | UNIQUE KEY `FK_contacts` (`FK_contacts`,`FK_entity`),
30 | KEY `FK_contacts_2` (`FK_contacts`),
31 | KEY `FK_entity` (`FK_entity`)
32 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
33 |
34 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_profiles`;
35 | CREATE TABLE `glpi_plugin_manageentity_profiles` (
36 | `ID` int(11) NOT NULL auto_increment,
37 | `name` varchar(255) collate utf8_unicode_ci default NULL,
38 | `interface` varchar(50) collate utf8_unicode_ci NOT NULL default 'manageentity',
39 | `is_default` smallint(6) NOT NULL default '0',
40 | `manageentity` char(1) default NULL,
41 | PRIMARY KEY (`ID`),
42 | KEY `interface` (`interface`)
43 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
44 |
45 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_preference`;
46 | CREATE TABLE `glpi_plugin_manageentity_preference` (
47 | `ID` int(11) NOT NULL auto_increment,
48 | `user_id` int(11) NOT NULL,
49 | `show` varchar(255) NOT NULL,
50 | PRIMARY KEY (`ID`)
51 | ) ENGINE=MyISAM;
--------------------------------------------------------------------------------
/ajax/dropdownGenerateCriCategories.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | if (strpos($_SERVER['PHP_SELF'], "dropdownGenerateCriCategories.php")) {
31 | header("Content-Type: text/html; charset=UTF-8");
32 | Html::header_nocache();
33 | } else if (!defined('GLPI_ROOT')) {
34 | die("Sorry. You can't access this file directly");
35 | }
36 |
37 | $opt = ['entity' => $_POST["entity_restrict"]];
38 | $condition =[];
39 |
40 | $currentcateg = new ITILCategory();
41 | $currentcateg->getFromDB($_POST['value']);
42 |
43 | if ($_POST["type"]) {
44 | switch ($_POST['type']) {
45 | case Ticket::INCIDENT_TYPE :
46 | $condition['is_incident'] = 1;
47 | if ($currentcateg->getField('is_incident') == 1) {
48 | $opt['value'] = $_POST['value'];
49 | }
50 | break;
51 |
52 | case Ticket::DEMAND_TYPE:
53 | $condition['is_request'] = 1;
54 | if ($currentcateg->getField('is_request') == 1) {
55 | $opt['value'] = $_POST['value'];
56 | }
57 | break;
58 | }
59 | }
60 |
61 | $opt['condition'] = $condition;
62 | ITILCategory::dropdown($opt);
63 |
--------------------------------------------------------------------------------
/front/cridetail.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Servicecatalog\Main;
31 | use GlpiPlugin\Manageentities\Entity;
32 |
33 | Session::checkLoginUser();
34 |
35 | if (!isset($_GET["id"])) $_GET["id"] = 0;
36 | if (!isset($_GET["users_id"])) {
37 | $users_id = Session::getLoginUserID();
38 | } else {
39 | $users_id = $_GET["users_id"];
40 | }
41 |
42 | $cri = new TicketTask();
43 |
44 | $cri->checkGlobal(READ);
45 |
46 | if (Session::getCurrentInterface() == 'central') {
47 | Html::header(__('Entities portal', 'manageentities'), '', "management", Entity::class);
48 | } else {
49 | if (Plugin::isPluginActive('servicecatalog')) {
50 | Main::showDefaultHeaderHelpdesk(__('Entities portal', 'manageentities'));
51 | } else {
52 | Html::helpHeader(__('Entities portal', 'manageentities'));
53 | }
54 | }
55 |
56 | $cri->display($_GET);
57 |
58 | if (Session::getCurrentInterface() != 'central'
59 | && Plugin::isPluginActive('servicecatalog')) {
60 |
61 | Main::showNavBarFooter('manageentities');
62 | }
63 |
64 | if (Session::getCurrentInterface() == 'central') {
65 | Html::footer();
66 | } else {
67 | Html::helpFooter();
68 | }
69 |
--------------------------------------------------------------------------------
/front/generatecri.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use Glpi\Exception\Http\AccessDeniedHttpException;
31 | use GlpiPlugin\Manageentities\GenerateCRI;
32 | use GlpiPlugin\Servicecatalog\Main;
33 |
34 | Session::checkLoginUser();
35 |
36 | if (Session::getCurrentInterface() == 'central') {
37 | Html::header(__('Entities portal', 'manageentities'), '', "helpdesk", GenerateCRI::class);
38 | } else {
39 | if (Plugin::isPluginActive('servicecatalog')) {
40 | Main::showDefaultHeaderHelpdesk(__('Entities portal', 'manageentities'));
41 | } else {
42 | Html::helpHeader(__('Entities portal', 'manageentities'));
43 | }
44 | }
45 | if (Session::haveRight("ticket", CREATE)) {
46 | $generatecri = new GenerateCRI();
47 | $generatecri->showWizard($ticket = new Ticket(), $_SESSION['glpiactive_entity']);
48 | } else {
49 | throw new AccessDeniedHttpException();
50 | }
51 |
52 | if (Session::getCurrentInterface() != 'central'
53 | && Plugin::isPluginActive('servicecatalog')) {
54 |
55 | Main::showNavBarFooter('manageentities');
56 | }
57 |
58 | if (Session::getCurrentInterface() == 'central') {
59 | Html::footer();
60 | } else {
61 | Html::helpFooter();
62 | }
63 |
--------------------------------------------------------------------------------
/front/cri.send.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use Glpi\Exception\Http\BadRequestHttpException;
31 | use GlpiPlugin\Manageentities\Cri;
32 |
33 | Session::checkLoginUser();
34 |
35 | if (isset($_GET["file"])) { // for other file
36 | $splitter = explode("/", $_GET["file"]);
37 |
38 | if (count($splitter) == 3) {
39 | $send = false;
40 | if (
41 | ($splitter[1] == "manageentities")
42 | && Session::haveRight("plugin_manageentities_cri_create", READ)
43 | ) {
44 | $send = GLPI_DOC_DIR . "/" . $_GET["file"];
45 | }
46 | $cri = new Cri();
47 | if ($send && file_exists($send)) {
48 | $doc = new Document();
49 | $doc->fields['filepath'] = $_GET["file"];
50 | $doc->fields['mime'] = 'application/pdf';
51 | $doc->fields['filename'] = $splitter[2];
52 | $cri->send($doc);
53 | } else {
54 | throw new BadRequestHttpException(__('Unauthorized access to this file'), true);
55 | }
56 |
57 | } else {
58 | throw new BadRequestHttpException(__('Invalid filename'), true);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/tool/thumb.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
64 |
65 |
--------------------------------------------------------------------------------
/front/config.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\Config;
31 | use GlpiPlugin\Manageentities\Entity;
32 |
33 | if (Plugin::isPluginActive("manageentities")) {
34 | if (Session::haveRight("plugin_manageentities", UPDATE)) {
35 | $config = new Config();
36 |
37 | if (isset($_POST["update_config"])) {
38 | Session::checkRight("config", UPDATE);
39 | $config->update($_POST);
40 | Html::back();
41 |
42 | } else {
43 | Html::header(__('Entities portal', 'manageentities'), '', "management", Entity::class);
44 | $config->GetFromDB(1);
45 | $config->showConfigForm();
46 | //$config->showDetails();
47 | $config->showFormCompany();
48 |
49 | Html::footer();
50 | }
51 |
52 | } else {
53 | Html::header(__('Setup'), '', "config", "plugin");
54 | echo "";
55 | echo "" . __("You don't have permission to perform this action.") . "
";
56 | Html::footer();
57 | }
58 |
59 | } else {
60 | Html::header(__('Setup'), '', "config", "plugin");
61 | echo "";
62 | echo "" . __('Please activate the plugin', 'manageentities') . "
";
63 | Html::footer();
64 | }
65 |
--------------------------------------------------------------------------------
/front/contract.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\Contract;
31 | use GlpiPlugin\Manageentities\ContractDay;
32 | use GlpiPlugin\Manageentities\Entity;
33 |
34 | $contractday = new ContractDay();
35 | $contract = new Contract();
36 |
37 | if (isset($_POST["addcontract"])) {
38 | $contract->check(-1, UPDATE);
39 | $newID = $contract->add($_POST);
40 | Html::back();
41 |
42 | } else if (isset($_POST["delcontract"])) {
43 | $contract->check($_POST["id"], UPDATE);
44 | $contract->delete($_POST);
45 | Html::back();
46 |
47 | } else if (isset($_POST["updatecontract"])) {
48 | $contract->check($_POST["id"], UPDATE);
49 | $contract->update($_POST);
50 | Html::back();
51 |
52 | } else if (isset($_POST["add_nbday"]) && isset($_POST['nbday'])) {
53 | Session::checkRight("contract", UPDATE);
54 | $contractday->addNbDay($_POST);
55 | Html::back();
56 |
57 | } else if (isset($_POST["delete_nbday"])) {
58 | Session::checkRight("contract", UPDATE);
59 | foreach ($_POST["item_nbday"] as $key => $val) {
60 | if ($val == 1) {
61 | $contractday->delete(['id' => $key]);
62 | }
63 | }
64 | Html::back();
65 |
66 | } else {
67 | $contract->checkGlobal(READ);
68 |
69 | Html::header(ContractDay::getTypeName(2), '', "management", Entity::class, "contractday");
70 | $contract->display($_GET);
71 |
72 | Html::footer();
73 | }
74 |
--------------------------------------------------------------------------------
/install/update_214_215.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | /**
31 | * Update from 2.1.4 to 2.1.5
32 | *
33 | * @return bool for success (will die for most error)
34 | * */
35 | function update214to215() {
36 | global $DB;
37 |
38 | $migration = new Migration(215);
39 | $migration->addField('glpi_plugin_manageentities_contractdays', 'contract_type', 'tinyint(1)', array('value' => '0'));
40 | $migration->executeMigration();
41 |
42 | $query = " SELECT * FROM `glpi_plugin_manageentities_contracts`";
43 | if ($result = $DB->doQuery($query)) {
44 | if ($DB->numrows($result) > 0) {
45 | while ($data = $DB->fetchAssoc($result)) {
46 |
47 | $query_contractdays = "SELECT * FROM `glpi_plugin_manageentities_contractdays` WHERE `contracts_id` = " . $data['contracts_id'].";";
48 | if ($result_contractdays = $DB->doQuery($query_contractdays)) {
49 | if ($DB->numrows($result_contractdays) > 0) {
50 | while ($data_contractdays = $DB->fetchAssoc($result_contractdays)) {
51 | $query = "UPDATE `glpi_plugin_manageentities_contractdays` SET `contract_type` = " . $data['contract_type'].";";
52 | $DB->doQuery($query);
53 | }
54 | }
55 | }
56 | }
57 | }
58 | }
59 |
60 | $migration->executeMigration();
61 |
62 | return true;
63 | }
64 |
65 | ?>
66 |
--------------------------------------------------------------------------------
/public/scripts/script-directhelpdesk.js.php:
--------------------------------------------------------------------------------
1 |
11 |
12 | $(window).on("load", function() {
13 | const newDiv = document.createElement('div');
14 | const newButton = document.createElement('button');
15 | const add_text = "";
16 | const add_text_collapsed = "";
17 |
18 | newButton.id = 'launch-directhelpdesk-modal';
19 | newButton.classList.add('btn', 'btn-sm', 'btn-primary', 'me-1');
20 |
21 | function updateButtonState() {
22 | const collapsed = $('body').hasClass('navbar-collapsed');
23 | if (collapsed) {
24 | newButton.style.marginLeft = '0px';
25 | newButton.textContent = add_text_collapsed;
26 | } else {
27 | newButton.style.marginLeft = '70px';
28 | newButton.textContent = add_text;
29 | }
30 | }
31 |
32 | // état initial
33 | updateButtonState();
34 |
35 | newDiv.appendChild(newButton);
36 |
37 | // Insérer avant le bouton existant
38 | const existingButton = document.querySelector('.trigger-fuzzy');
39 | existingButton.parentNode.insertBefore(newDiv, existingButton);
40 |
41 | // Préparer la modal
42 | const page = document.querySelector("div.page");
43 | const modalContainer = document.createElement('div');
44 | modalContainer.id = 'directhelpdeskmodalcontainer';
45 | page.append(modalContainer);
46 |
47 | // clic sur le bouton
48 | newButton.addEventListener('click', function() {
49 | if (!document.getElementById('directhelpdesk-modal')) {
50 | $('#directhelpdeskmodalcontainer').load(
51 | '',
52 | function() {
53 | $("#directhelpdesk-modal").modal('show');
54 | }
55 | );
56 | } else {
57 | $("#directhelpdesk-modal").modal('show');
58 | }
59 | });
60 |
61 | // Fermer la modal si clic en dehors
62 | $(document).on('click', function(event) {
63 | const modal = document.getElementById('directhelpdesk-modal');
64 | if (modal && event.target === modal) {
65 | $(modal).modal('hide');
66 | }
67 | });
68 |
69 | // Gérer toggle du menu
70 | $('.reduce-menu').on('click', function() {
71 | updateButtonState();
72 | });
73 | });
74 |
75 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\Config;
31 |
32 | header("Content-Type: text/html; charset=UTF-8");
33 | Html::header_nocache();
34 |
35 | if (!defined('GLPI_ROOT')) {
36 | die("Can not acces directly to this file");
37 | }
38 |
39 | if (isset($_POST["action"])) {
40 | switch ($_POST["action"]) {
41 | case 'title_show_hourorday' :
42 | $config = Config::getInstance();
43 | switch ($_POST["hourorday"]) {
44 | case Config::DAY :
45 | echo __('Number of hours by day', 'manageentities');
46 |
47 | break;
48 | case Config::HOUR :
49 | echo __('Only ticket accepted are taking into account for consumption calculation', 'manageentities');
50 |
51 | break;
52 | }
53 | break;
54 | case 'value_show_hourorday' :
55 | $config = Config::getInstance();
56 | switch ($_POST["hourorday"]) {
57 | case Config::DAY :
58 | echo Html::input('hourbyday', ['value' => $config->fields["hourbyday"], 'size' => 5]);
59 | echo Html::hidden('needvalidationforcri', ['value' => 0]);
60 | break;
61 | case Config::HOUR :
62 | Dropdown::showYesNo("needvalidationforcri", $config->fields["needvalidationforcri"]);
63 | echo Html::hidden('hourbyday', ['value' => 0]);
64 | break;
65 | }
66 | break;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Servicecatalog.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | use CommonGLPI;
33 | use GlpiPlugin\Manageentities\Entity;
34 |
35 | if (!defined('GLPI_ROOT')) {
36 | die("Sorry. You can't access directly to this file");
37 | }
38 |
39 |
40 | class Servicecatalog extends CommonGLPI
41 | {
42 |
43 | static $rightname = 'plugin_manageentities';
44 |
45 | var $dohistory = false;
46 |
47 | static function canUse()
48 | {
49 | $Entity = new Entity();
50 | return $Entity->canView();
51 | }
52 |
53 | /**
54 | * @return string
55 | */
56 | static function getMenuLink()
57 | {
58 | global $CFG_GLPI;
59 |
60 | return PLUGIN_MANAGEENTITIES_WEBDIR . "/front/entity.php";
61 | }
62 |
63 | /**
64 | * @return string
65 | */
66 | static function getNavBarLink()
67 | {
68 | global $CFG_GLPI;
69 |
70 | return PLUGIN_MANAGEENTITIES_WEBDIR . "/front/entity.php";
71 | }
72 |
73 | static function getMenuLogo()
74 | {
75 | return Entity::getIcon();
76 | }
77 |
78 | static function getMenuTitle()
79 | {
80 | return __('Manage your contracts', 'manageentities');
81 | }
82 |
83 |
84 | static function getMenuComment()
85 | {
86 | return __('Manage your contracts', 'manageentities');
87 | }
88 |
89 | static function getLinkList()
90 | {
91 | return "";
92 | }
93 |
94 | static function getList()
95 | {
96 | return "";
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/tool/option/area.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export default {
21 | title: {
22 | text: 'Area Chart',
23 | left: 'center',
24 | top: '3%',
25 | textStyle: {
26 | fontWeight: 'normal'
27 | }
28 | },
29 | grid: {
30 | left: '3%',
31 | right: '4%',
32 | bottom: '12%',
33 | containLabel: true
34 | },
35 | xAxis: {
36 | type: 'category',
37 | boundaryGap: false,
38 | data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday']
39 | },
40 | yAxis: {
41 | type: 'value',
42 | splitNumber: 3
43 | },
44 | dataZoom: {
45 |
46 | },
47 | series: [
48 | {
49 | name:'Email',
50 | type:'line',
51 | stack: '总量',
52 | areaStyle: {normal: {}},
53 | data:[120, 132, 101, 134, 90, 230, 210]
54 | },
55 | {
56 | name:'联盟广告',
57 | type:'line',
58 | stack: '总量',
59 | areaStyle: {normal: {}},
60 | data:[220, 182, 191, 234, 290, 330, 310]
61 | },
62 | {
63 | name:'视频广告',
64 | type:'line',
65 | stack: '总量',
66 | areaStyle: {normal: {}},
67 | data:[150, 232, 201, 154, 190, 330, 410]
68 | },
69 | {
70 | name:'直接访问',
71 | type:'line',
72 | stack: '总量',
73 | areaStyle: {normal: {}},
74 | data:[320, 332, 301, 334, 390, 330, 320]
75 | },
76 | {
77 | name:'搜索引擎',
78 | type:'line',
79 | stack: '总量',
80 | label: {
81 | normal: {
82 | show: true,
83 | position: 'top'
84 | }
85 | },
86 | areaStyle: {normal: {}},
87 | data:[820, 932, 901, 934, 1290, 1330, 1320]
88 | }
89 | ]
90 | };
91 |
--------------------------------------------------------------------------------
/.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;sudo apt-get install composer;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); [[ -f composer.json ]] && composer install --no-dev; 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 | - name: Create Release
26 | id: create_release
27 | uses: actions/create-release@v1
28 | env:
29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 | with:
31 | tag_name: ${{ github.ref }}
32 | release_name: |
33 | GLPI ${{ steps.build_.outputs.version_glpi }} : Version ${{ github.ref }} disponible / available
34 | body : Version ${{ steps.build_.outputs.tag }} released for GLPI ${{ steps.build_.outputs.version_glpi }}
35 | draft: false
36 | prerelease: true
37 | - name: Upload Release Asset
38 | id: upload-release-asset
39 | uses: actions/upload-release-asset@v1
40 | env:
41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 | GITHUB_NAME: ${{ github.event.repository.name }}
43 | with:
44 | 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
45 | asset_path: /home/runner/work/${{ github.event.repository.name }}/glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2
46 | asset_name: glpi-${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2
47 | asset_content_type: application/zip
48 |
49 |
--------------------------------------------------------------------------------
/front/cri.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use Glpi\Event;
31 | use GlpiPlugin\Manageentities\Cri;
32 | use GlpiPlugin\Manageentities\CriDetail;
33 |
34 | Session::checkLoginUser();
35 | if (!isset($_POST["cri"])) $_POST["cri"] = "";
36 | if (!isset($_GET["action"])) $_GET["action"] = "";
37 |
38 | Html::popHeader(__('Generation of the intervention report', 'manageentities'));
39 |
40 | $Cri = new Cri();
41 | $criDetail = new CriDetail();
42 |
43 | if (isset($_POST["addcridetail"])) {
44 | if ($Cri->canCreate()) {
45 | $criDetail->add($_POST);
46 | }
47 | if(strpos($_SERVER['HTTP_REFERER'],"generatecri.form.php") > 0){
48 | Html::redirect(PLUGIN_MANAGEENTITIES_WEBDIR."/front/generatecri.form.php?download=1&tickets_id=".$_POST['tickets_id']);
49 | } else{
50 | Html::back();
51 | }
52 |
53 | } else if (isset($_POST["updatecridetail"])) {
54 | if ($Cri->canCreate()) {
55 | if (isset($_POST['withcontract']) && !$_POST['withcontract']) {
56 | $_POST['contracts_id'] = 0;
57 | $_POST['plugin_manageentities_contractdays_id'] = 0;
58 | }
59 | $criDetail->update($_POST);
60 | }
61 | Html::back();
62 |
63 | } else if (isset($_POST["delcridetail"])) {
64 | if ($Cri->canCreate()) {
65 | $criDetail->delete($_POST);
66 | }
67 | Html::back();
68 |
69 | } else if (isset($_POST["purgedoc"])) {
70 | $doc = new Document();
71 | $input['id'] = $_POST['documents_id'];
72 | if ($doc->delete($input, 1)) {
73 | Event::log($input['id'], "documents", 4, "document", $_SESSION["glpiname"] . " " . __('Delete permanently'));
74 | }
75 | Html::back();
76 |
77 | }
78 |
79 | else {
80 | $Cri->showForm($_GET["job"], ['action' => $_GET["action"]]);
81 | }
82 |
83 | Html::popFooter();
84 |
--------------------------------------------------------------------------------
/install/sql/update-1.9.0.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentities_contracts`
2 | ADD `management` tinyint(1) NOT NULL default '0' COMMENT 'for the management mode (quarterly or annual or not)',
3 | ADD `contract_type` tinyint(1) NOT NULL default '0' COMMENT 'for the contract type (hour, intervention, unlimited or not)',
4 | ADD `date_signature` date default NULL,
5 | ADD `date_renewal` date default NULL,
6 | ADD INDEX `contracts_id` (`contracts_id`);
7 |
8 | ALTER TABLE `glpi_plugin_manageentities_contacts`
9 | ADD INDEX `contacts_id` (`contacts_id`);
10 |
11 | ALTER TABLE `glpi_plugin_manageentities_preferences`
12 | ADD INDEX `users_id` (`users_id`);
13 |
14 | ALTER TABLE `glpi_plugin_manageentities_configs`
15 | ADD `useprice` tinyint(1) NOT NULL default '1' COMMENT 'default for yes',
16 | ADD `hourorday` tinyint(1) NOT NULL default '0' COMMENT 'default for day',
17 | ADD `needvalidationforcri` tinyint(1) NOT NULL default '0' COMMENT 'if only CRI with validated ticket are taking into account for consumption calculation',
18 | ADD `use_publictask` tinyint(1) NOT NULL default '0' COMMENT 'default for no';
19 |
20 | UPDATE `glpi_plugin_manageentities_configs`
21 | SET `hourorday` = '0',`hourbyday` = '8',`needvalidationforcri` = '0'
22 | WHERE `id`='1';
23 |
24 | ALTER TABLE `glpi_plugin_manageentities_contractdays`
25 | ADD `name` varchar(255) collate utf8_unicode_ci default NULL,
26 | ADD `plugin_manageentities_contractstates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_manageentities_contractstates (id)',
27 | ADD `begin_date` date default NULL,
28 | ADD `end_date` date default NULL,
29 | ADD `report` decimal(20,2) default '0.00',
30 | ADD INDEX `plugin_manageentities_contractstates_id` (`plugin_manageentities_contractstates_id`);
31 |
32 | ALTER TABLE `glpi_plugin_manageentities_cridetails`
33 | ADD `tickets_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_tickets (id)',
34 | ADD INDEX `entities_id` (`entities_id`),
35 | ADD INDEX `tickets_id` (`tickets_id`);
36 |
37 | DROP TABLE IF EXISTS `glpi_plugin_manageentities_contractstates`;
38 | CREATE TABLE `glpi_plugin_manageentities_contractstates` (
39 | `id` int(11) NOT NULL auto_increment,
40 | `name` varchar(255) collate utf8_unicode_ci default NULL,
41 | `is_active` tinyint(1) NOT NULL default '0',
42 | `comment` text collate utf8_unicode_ci,
43 | PRIMARY KEY (`id`),
44 | KEY `name` (`name`),
45 | KEY `is_active` (`is_active`)
46 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
47 |
48 | DROP TABLE IF EXISTS `glpi_plugin_manageentities_taskcategories`;
49 | CREATE TABLE `glpi_plugin_manageentities_taskcategories` (
50 | `id` int(11) NOT NULL auto_increment,
51 | `taskcategories_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_taskcategories (id)',
52 | `is_usedforcount` tinyint(1) NOT NULL default '0',
53 | PRIMARY KEY (`id`),
54 | KEY `taskcategories_id` (`taskcategories_id`)
55 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--------------------------------------------------------------------------------
/public/lib/echarts/theme/tool/option/pie.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export default {
21 | legend: {
22 | bottom: '5%',
23 | data: ['rose1', 'rose2', 'rose3', 'rose4']
24 | },
25 | series : [
26 | {
27 | name:'半径模式',
28 | type:'pie',
29 | radius : [20, 80],
30 | center : ['25%', 110],
31 | label: {
32 | normal: {
33 | show: false
34 | },
35 | emphasis: {
36 | show: true
37 | }
38 | },
39 | lableLine: {
40 | normal: {
41 | show: false
42 | },
43 | emphasis: {
44 | show: true
45 | }
46 | },
47 | data:[
48 | {value:10, name:'rose1'},
49 | {value:5, name:'rose2'},
50 | {value:15, name:'rose3'},
51 | {value:25, name:'rose4'},
52 | {value:20, name:'rose5'},
53 | {value:35, name:'rose6'},
54 | {value:30, name:'rose7'},
55 | {value:40, name:'rose8'}
56 | ]
57 | },
58 | {
59 | name:'面积模式',
60 | type:'pie',
61 | radius : [30, 80],
62 | center : ['75%', 110],
63 | roseType : 'area',
64 | labelLine: {
65 | normal: {
66 | length: 5
67 | }
68 | },
69 | data:[
70 | {value:10, name:'rose1'},
71 | {value:5, name:'rose2'},
72 | {value:15, name:'rose3'},
73 | {value:25, name:'rose4'},
74 | {value:20, name:'rose5'},
75 | {value:35, name:'rose6'},
76 | {value:30, name:'rose7'},
77 | {value:40, name:'rose8'}
78 | ]
79 | },
80 | {
81 | name:'仪表盘',
82 | type:'gauge',
83 | radius : 100,
84 | center : ['50%', 280],
85 | detail : {formatter:'{value}%'},
86 | data:[
87 | {value:50, name:'Gauge'}
88 | ]
89 | }
90 | ]
91 | };
92 |
--------------------------------------------------------------------------------
/front/contractday.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\ContractDay;
31 | use GlpiPlugin\Manageentities\Entity;
32 |
33 | if (!isset($_GET["id"])) $_GET["id"] = "";
34 | if (!isset($_GET["contract_id"])) $_GET["contract_id"] = 0;
35 | if (!isset($_GET["showFromPlugin"])) $_GET["showFromPlugin"] = 0;
36 |
37 | $contractday = new ContractDay();
38 |
39 | if (isset($_POST["add"])) {
40 | $contractday->check(-1, UPDATE);
41 | $contractday->add($_POST);
42 | Html::back();
43 |
44 | } else if (isset($_POST["update"])) {
45 | $contractday->check($_POST["id"], UPDATE);
46 | $contractday->update($_POST);
47 | Html::back();
48 |
49 | } else if (isset($_POST["delete"])) {
50 | $contracts_id = $_POST["contracts_id"];
51 | $contractday->check($_POST["id"], UPDATE);
52 | $contractday->delete($_POST);
53 | Html::redirect(Toolbox::getItemTypeFormURL('Contract') . "?id=" . $contracts_id);
54 |
55 | } else if (isset($_POST["add_nbday"]) && isset($_POST['nbday'])) {
56 | Session::checkRight("contract", UPDATE);
57 | $contractday->addNbDay($_POST);
58 | Html::back();
59 |
60 | } else if (isset($_POST["delete_nbday"])) {
61 | Session::checkRight("contract", UPDATE);
62 | foreach ($_POST["item_nbday"] as $key => $val) {
63 | if ($val == 1) {
64 | $contractday->delete(['id' => $key]);
65 | }
66 | }
67 | Html::back();
68 |
69 | } else if (isset($_POST["deleteAll"])) {
70 | foreach ($_POST["item"] as $key => $val) {
71 | $input = ['id' => $key];
72 | if ($val == 1) {
73 | $contractday->check($key, UPDATE);
74 | $contractday->delete($input);
75 | }
76 | }
77 | Html::back();
78 |
79 | } else {
80 | Html::header(ContractDay::getTypeName(2), '', "management", Entity::class, "contractday");
81 | if (Session::haveRight("contract", READ)) {
82 | $contractday->display($_GET);
83 | }
84 | Html::footer();
85 | }
86 |
--------------------------------------------------------------------------------
/install/sql/update-1.5.0.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE `glpi_plugin_manageentity_profiles` DROP COLUMN `interface`, DROP COLUMN `is_default`, ADD `cri` char(1) default NULL AFTER `manageentity`;
2 |
3 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_config`;
4 | CREATE TABLE `glpi_plugin_manageentity_config` (
5 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
6 | `backup` INT( 11 ) NOT NULL ,
7 | `rubrique` INT( 11 ) NOT NULL
8 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
9 |
10 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_manageentity_critype`;
11 | CREATE TABLE `glpi_dropdown_plugin_manageentity_critype` (
12 | `ID` int(11) NOT NULL auto_increment,
13 | `name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
14 | `comments` text,
15 | PRIMARY KEY (`ID`),
16 | KEY `name` (`name`)
17 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
18 |
19 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_criprice`;
20 | CREATE TABLE `glpi_plugin_manageentity_criprice` (
21 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
22 | `FK_entities` int(11) NOT NULL default '0',
23 | `FK_typecri` INT( 11 ) NOT NULL ,
24 | `price` decimal(20,4) NOT NULL default '0.0000'
25 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
26 |
27 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_dayforcontract`;
28 | CREATE TABLE `glpi_plugin_manageentity_dayforcontract` (
29 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
30 | `FK_entities` int(11) NOT NULL default '0',
31 | `FK_typecri` INT( 11 ) NOT NULL ,
32 | `FK_contracts` INT( 11 ) NOT NULL ,
33 | `nbday` decimal(20,2) default '0.00'
34 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
35 |
36 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_critechnicians`;
37 | CREATE TABLE `glpi_plugin_manageentity_critechnicians` (
38 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
39 | `FK_ticket` INT( 11 ) NOT NULL ,
40 | `FK_users` INT( 11 ) NOT NULL
41 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
42 |
43 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_cridetails`;
44 | CREATE TABLE `glpi_plugin_manageentity_cridetails` (
45 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
46 | `FK_entities` int(11) NOT NULL default '0',
47 | `date` date default NULL,
48 | `FK_doc` INT( 11 ) NOT NULL ,
49 | `type_cri` INT( 11 ) NOT NULL ,
50 | `withcontract` INT( 11 ) NOT NULL ,
51 | `FK_contracts` INT( 11 ) NOT NULL,
52 | `realtime` decimal(20,2) default '0.00',
53 | `technicians` varchar(255) collate utf8_unicode_ci NOT NULL default ''
54 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
55 |
56 | ALTER TABLE `glpi_plugin_manageentity_contacts` ADD `isdefault` int(11) NOT NULL default '0';
57 | ALTER TABLE `glpi_plugin_manageentity_contracts` ADD `isdefault` int(11) NOT NULL default '0';
58 | ALTER TABLE `glpi_plugin_manageentity_contacts` CHANGE FK_entity `FK_entities` int(11) NOT NULL default '0';
59 | ALTER TABLE `glpi_plugin_manageentity_contracts` CHANGE FK_entity `FK_entities` int(11) NOT NULL default '0';
60 | ALTER TABLE `glpi_plugin_manageentity_documents` CHANGE FK_entity `FK_entities` int(11) NOT NULL default '0';
61 | INSERT INTO `glpi_plugin_manageentity_config` ( `ID`, `backup` , `rubrique`) VALUES ('1', '0','-1');
--------------------------------------------------------------------------------
/src/TicketTask.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | use CommonDBTM;
33 | use Html;
34 |
35 | if (!defined('GLPI_ROOT')) {
36 | die("Sorry. You can't access directly to this file");
37 | }
38 |
39 | class TicketTask extends CommonDBTM
40 | {
41 |
42 | var $dohistory = false;
43 |
44 | static $rightname = "plugin_manageentities";
45 |
46 | static public function postForm($params)
47 | {
48 | global $CFG_GLPI;
49 |
50 | $tickettask = $params['item'];
51 | switch ($tickettask->getType()) {
52 | case 'TicketTask':
53 |
54 | $rand = mt_rand();
55 | echo ' | ';
56 | echo '';
57 | echo " ";
58 | $value = $tickettask->fields['date'];
59 | if (!empty($tickettask->fields['begin'])) {
60 | $value = date('Y-m-d H:i:s', strtotime($tickettask->fields['begin'] . ' + 1 DAY'));
61 | }
62 | $randDate = Html::showDateTimeField('new_date', [
63 | 'value' => $value,
64 | 'rand' => $rand,
65 | 'mintime' => $CFG_GLPI["planning_begin"],
66 | 'maxtime' => $CFG_GLPI["planning_end"]
67 | ]);
68 | $params = json_encode([
69 | 'root_doc' => PLUGIN_MANAGEENTITIES_WEBDIR,
70 | // 'new_date_id' => 'showdate' . $randDate,
71 | 'tickets_id' => $tickettask->fields['tickets_id'],
72 | 'tickettasks_id' => $tickettask->fields['id']
73 | ]);
74 | $tickettask_id = $tickettask->fields['id'];
75 | echo "";
76 | echo "";
78 |
79 | echo "";
80 | echo ' ';
81 | echo ' |
';
82 | break;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/roma.js:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | */
20 |
21 | (function(root, factory) {
22 | if (typeof define === 'function' && define.amd) {
23 | // AMD. Register as an anonymous module.
24 | define(['exports', 'echarts'], factory);
25 | } else if (
26 | typeof exports === 'object' &&
27 | typeof exports.nodeName !== 'string'
28 | ) {
29 | // CommonJS
30 | factory(exports, require('echarts/lib/echarts'));
31 | } else {
32 | // Browser globals
33 | factory({}, root.echarts);
34 | }
35 | })(this, function(exports, echarts) {
36 | var log = function(msg) {
37 | if (typeof console !== 'undefined') {
38 | console && console.error && console.error(msg);
39 | }
40 | };
41 | if (!echarts) {
42 | log('ECharts is not Loaded');
43 | return;
44 | }
45 |
46 | var colorPalette = [
47 | '#E01F54',
48 | '#001852',
49 | '#f5e8c8',
50 | '#b8d2c7',
51 | '#c6b38e',
52 | '#a4d8c2',
53 | '#f3d999',
54 | '#d3758f',
55 | '#dcc392',
56 | '#2e4783',
57 | '#82b6e9',
58 | '#ff6347',
59 | '#a092f1',
60 | '#0a915d',
61 | '#eaf889',
62 | '#6699FF',
63 | '#ff6666',
64 | '#3cb371',
65 | '#d5b158',
66 | '#38b6b6'
67 | ];
68 |
69 | var theme = {
70 | color: colorPalette,
71 |
72 | visualMap: {
73 | color: ['#e01f54', '#e7dbc3'],
74 | textStyle: {
75 | color: '#333'
76 | }
77 | },
78 |
79 | candlestick: {
80 | itemStyle: {
81 | color: '#e01f54',
82 | color0: '#001852'
83 | },
84 | lineStyle: {
85 | width: 1,
86 | color: '#f5e8c8',
87 | color0: '#b8d2c7'
88 | },
89 | areaStyle: {
90 | color: '#a4d8c2',
91 | color0: '#f3d999'
92 | }
93 | },
94 |
95 | graph: {
96 | itemStyle: {
97 | color: '#a4d8c2'
98 | },
99 | linkStyle: {
100 | color: '#f3d999'
101 | }
102 | },
103 |
104 | gauge: {
105 | axisLine: {
106 | lineStyle: {
107 | color: [
108 | [0.2, '#E01F54'],
109 | [0.8, '#b8d2c7'],
110 | [1, '#001852']
111 | ],
112 | width: 8
113 | }
114 | }
115 | }
116 | };
117 |
118 | echarts.registerTheme('roma', theme);
119 | });
120 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/tool/option/bar.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export default {
21 | title: {
22 | text: 'Bar Chart',
23 | left: 'center',
24 | top: '3%',
25 | textStyle: {
26 | fontWeight: 'normal'
27 | }
28 | },
29 | toolbox: {
30 | top: '3%',
31 | feature: {
32 | magicType: {
33 | type: ['line', 'bar', 'stack', 'tiled']
34 | },
35 | restore: {},
36 | dataZoom: {},
37 | saveAsImage: {}
38 | }
39 | },
40 | grid: {
41 | left: '13%',
42 | right: '5%',
43 | bottom: '5%',
44 | textStyle: {
45 | fontWeight: 'normal'
46 | }
47 | },
48 | xAxis: {
49 | type: 'value'
50 | },
51 | yAxis: {
52 | type: 'category',
53 | data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday']
54 | },
55 | series: [
56 | {
57 | name:'直接访问',
58 | type:'bar',
59 | stack: '总量',
60 | label: {
61 | normal: {
62 | show: true,
63 | position: 'insideRight'
64 | }
65 | },
66 | data:[320, 302, 301, 334, 390, 330, 320]
67 | },
68 | {
69 | name:'邮件营销',
70 | type:'bar',
71 | stack: '总量',
72 | label: {
73 | normal: {
74 | show: true,
75 | position: 'insideRight'
76 | }
77 | },
78 | data:[120, 132, 101, 134, 90, 230, 210]
79 | },
80 | {
81 | name:'联盟广告',
82 | type:'bar',
83 | stack: '总量',
84 | label: {
85 | normal: {
86 | show: true,
87 | position: 'insideRight'
88 | }
89 | },
90 | data:[220, 182, 191, 234, 290, 330, 310]
91 | },
92 | {
93 | name:'视频广告',
94 | type:'bar',
95 | stack: '总量',
96 | label: {
97 | normal: {
98 | show: true,
99 | position: 'insideRight'
100 | }
101 | },
102 | data:[150, 212, 201, 154, 190, 330, 410]
103 | },
104 | {
105 | name:'搜索引擎',
106 | type:'bar',
107 | stack: '总量',
108 | label: {
109 | normal: {
110 | show: true,
111 | position: 'insideRight'
112 | }
113 | },
114 | data:[820, 832, 901, 934, 1290, 1330, 1320]
115 | }
116 | ]
117 | };
--------------------------------------------------------------------------------
/ajax/dropdownContract.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use Glpi\Exception\Http\NotFoundHttpException;
31 | use GlpiPlugin\Manageentities\ContractDay;
32 | use GlpiPlugin\Manageentities\ContractState;
33 |
34 | header("Content-Type: text/html; charset=UTF-8");
35 | Html::header_nocache();
36 | Session::checkLoginUser();
37 |
38 | if (!isset($_POST["contracts_id"])) {
39 | throw new NotFoundHttpException();
40 | }
41 |
42 | if (isset($_POST["contracts_id"])) {
43 | $contract = new Contract();
44 | $contract->getEmpty();
45 | $contract->getFromDB($_POST["contracts_id"]);
46 |
47 | $contractdays_id = 0;
48 | if ($_POST["current_contracts_id"] == $_POST["contracts_id"]) {
49 | $contractdays_id = $_POST["contractdays_id"];
50 | }
51 |
52 | if ($contractdays_id == 0) {
53 | $contractday = new ContractDay();
54 | $restrict = ['entities_id' => $contract->fields['entities_id'],
55 | 'contracts_id' => $_POST["contracts_id"],
56 | [
57 | 'OR' => [
58 | ['plugin_manageentities_contractstates_id' => ContractState::getOpenedStates()],
59 | ['id' => $contractdays_id]
60 | ]
61 | ]];
62 | $datas = $contractday->find($restrict);
63 | //if a single contractday
64 | if (count($datas) == 1) {
65 | $datas = reset($datas);
66 | //Default contractday Display
67 | $contractdays_id = $datas['id'];
68 | }
69 | }
70 | if (isset($contract->fields['states_id']) && $contract->fields['states_id'] > 0) {
71 | echo __('Status') . " : " . Dropdown::getDropdownName("glpi_states", $contract->fields['states_id']);
72 | echo "
";
73 | }
74 |
75 | $restrict = ['entities_id' => $contract->fields['entities_id'],
76 | 'contracts_id' => $_POST["contracts_id"],
77 | [
78 | 'OR' => [
79 | ['plugin_manageentities_contractstates_id' => ContractState::getOpenedStates()],
80 | ['id' => $contractdays_id]
81 | ]
82 | ]];
83 |
84 | Dropdown::show(ContractDay::class, ['name' => 'plugin_manageentities_contractdays_id',
85 | 'value' => $contractdays_id,
86 | 'condition' => $restrict,
87 | 'width' => $_POST['width']]);
88 | }
89 |
--------------------------------------------------------------------------------
/src/DirectHelpdeskInjection.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | use PluginDatainjectionCommonInjectionLib;
33 | use PluginDatainjectionInjectionInterface;
34 | use Search;
35 |
36 | if (!defined('GLPI_ROOT')) {
37 | die("Sorry. You can't access directly to this file");
38 | }
39 |
40 | /**
41 | * Class DirectHelpdeskInjection
42 | */
43 | class DirectHelpdeskInjection extends DirectHelpdesk
44 | implements PluginDatainjectionInjectionInterface
45 | {
46 |
47 | public static function getTable($classname = null)
48 | {
49 | return DirectHelpdesk::getTable();
50 | }
51 |
52 | /**
53 | * @return bool
54 | */
55 | public function isPrimaryType()
56 | {
57 | return true;
58 | }
59 |
60 | /**
61 | * @return array
62 | */
63 | public function connectedTo()
64 | {
65 | return [];
66 | }
67 |
68 | /**
69 | * @param string $primary_type
70 | * @return array|the
71 | */
72 | public function getOptions($primary_type = '')
73 | {
74 | $tab = Search::getOptions(get_parent_class($this));
75 |
76 | $tab[4]['checktype'] = 'date';
77 |
78 | //$blacklist = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions();
79 | //Remove some options because some fields cannot be imported
80 | $notimportable = [30, 80];
81 | $options['ignore_fields'] = $notimportable;
82 |
83 | $options['displaytype'] = [
84 | "timestamp" => [9],
85 | "user" => [10],
86 | "multiline_text" => [8],
87 | "date" => [4],
88 | "bool" => [11]
89 | ];
90 |
91 | $tab = PluginDatainjectionCommonInjectionLib::addToSearchOptions($tab, $options, $this);
92 |
93 | return $tab;
94 | }
95 |
96 |
97 | /**
98 | * Standard method to add an object into glpi
99 | * WILL BE INTEGRATED INTO THE CORE IN 0.80
100 | * @param array|fields $values
101 | * @param array|options $options
102 | * @return an array of IDs of newly created objects : for example array(Computer=>1, Networkport=>10)
103 | * @internal param fields $values to add into glpi
104 | * @internal param options $options used during creation
105 | */
106 | public function addOrUpdateObject($values = [], $options = [])
107 | {
108 | $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options);
109 | $lib->processAddOrUpdate();
110 | return $lib->getInjectionResults();
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/front/directhelpdesk.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\DirectHelpdesk;
31 | use GlpiPlugin\Servicecatalog\Main;
32 |
33 | Session::checkLoginUser();
34 |
35 | if (Session::getCurrentInterface() == 'central') {
36 | Html::header(__('Entities portal', 'manageentities'), '', "helpdesk", DirectHelpdesk::class);
37 | } else {
38 | if (Plugin::isPluginActive('servicecatalog')) {
39 | Main::showDefaultHeaderHelpdesk(__('Entities portal', 'manageentities'));
40 | } else {
41 | Html::helpHeader(__('Entities portal', 'manageentities'));
42 | }
43 | }
44 |
45 | echo Html::scriptBlock("
46 | function reloadPageWithParam(namecheck) {
47 | if (namecheck == 'checkbox3') {
48 | var param = document.getElementById('checkbox3').checked ? '1' : '0';
49 | window.location.href = '?checkbox3=' + param;
50 | }
51 | if (namecheck == 'checkbox2') {
52 | var param = document.getElementById('checkbox2').checked ? '1' : '0';
53 | window.location.href = '?checkbox2=' + param;
54 | }
55 | }");
56 |
57 | if (!isset($_GET['checkbox3'])) {
58 | $_GET['checkbox3'] = 1;
59 | }
60 |
61 | $checkbox2State = isset($_GET['checkbox2']) ? $_GET['checkbox2'] : '0';
62 | $checkbox3State = isset($_GET['checkbox3']) ? $_GET['checkbox3'] : '0';
63 |
64 | echo "";
65 | echo "";
80 | echo "
";
81 |
82 | if ($checkbox3State === '1') {
83 | $min = DirectHelpdesk::THREE_HOUR;
84 | } else if ($checkbox2State === '1') {
85 | $min = DirectHelpdesk::TWO_HOUR;
86 | } else {
87 | $min = 0;
88 | }
89 |
90 | DirectHelpdesk::showDashboard($min);
91 |
92 | Search::show(DirectHelpdesk::class);
93 |
94 | if (Session::getCurrentInterface() != 'central'
95 | && Plugin::isPluginActive('servicecatalog')) {
96 | Main::showNavBarFooter('manageentities');
97 | }
98 |
99 | if (Session::getCurrentInterface() == 'central') {
100 | Html::footer();
101 | } else {
102 | Html::helpFooter();
103 | }
104 |
--------------------------------------------------------------------------------
/ajax/getDropdownNumber.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | header("Content-Type: text/html; charset=UTF-8");
31 | Html::header_nocache();
32 |
33 | if (!defined('GLPI_ROOT')) {
34 | die("Can not acces directly to this file");
35 | }
36 |
37 | Session::checkLoginUser();
38 |
39 | global $CFG_GLPI;
40 |
41 | $used = [];
42 |
43 | if (isset($_POST['used'])) {
44 | $used = $_POST['used'];
45 | }
46 |
47 | if (!isset($_POST['value'])) {
48 | $_POST['value'] = 0;
49 | }
50 |
51 | $one_item = -1;
52 | if (isset($_POST['_one_id'])) {
53 | $one_item = $_POST['_one_id'];
54 | }
55 |
56 | if (!isset($_POST['page'])) {
57 | $_POST['page'] = 1;
58 | $_POST['page_limit'] = $CFG_GLPI['dropdown_max'];
59 | }
60 |
61 | if (isset($_POST['toadd'])) {
62 | $toadd = $_POST['toadd'];
63 | } else {
64 | $toadd = [];
65 | }
66 |
67 | $datas = [];
68 | // Count real items returned
69 | $count = 0;
70 |
71 | if ($_POST['page'] == 1) {
72 | if (count($toadd)) {
73 | foreach ($toadd as $key => $val) {
74 | if (($one_item < 0) || ($one_item == $key)) {
75 | array_push($datas, ['id' => $key,
76 | 'text' => strval(stripslashes($val))]);
77 | }
78 | }
79 | }
80 | }
81 |
82 | $values = [];
83 | if (!empty($_POST['searchText'])) {
84 | for ($i = $_POST['min']; $i <= $_POST['max']; $i += $_POST['step']) {
85 | if (strstr($i, $_POST['searchText'])) {
86 | $values[$i] = $i;
87 | }
88 | }
89 | } else {
90 | for ($i = $_POST['min']; $i <= $_POST['max']; $i += $_POST['step']) {
91 | $values[] = $i;
92 | }
93 | }
94 | if ($one_item < 0 && count($values)) {
95 | $start = ($_POST['page'] - 1) * $_POST['page_limit'];
96 | $tosend = array_splice($values, $start, $_POST['page_limit']);
97 | foreach ($tosend as $i) {
98 | $txt = $i;
99 | if (isset($_POST['unit'])) {
100 | $txt = Dropdown::getValueWithUnit($i, $_POST['unit']);
101 | }
102 | array_push($datas, ['id' => $i,
103 | 'text' => strval($txt)]);
104 | $count++;
105 | }
106 |
107 | } else {
108 | if (!isset($toadd[$one_item])) {
109 | if (isset($_POST['unit'])) {
110 | $txt = Dropdown::getValueWithUnit($one_item, $_POST['unit']);
111 | }
112 | array_push($datas, ['id' => $one_item,
113 | 'text' => strval(stripslashes($txt))]);
114 | $count++;
115 | }
116 | }
117 |
118 | if (($one_item >= 0)
119 | && isset($datas[0])) {
120 | echo json_encode($datas[0]);
121 | } else {
122 | $ret['results'] = $datas;
123 | $ret['count'] = $count;
124 | echo json_encode($ret);
125 | }
126 |
--------------------------------------------------------------------------------
/front/generatecri.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use Glpi\Exception\Http\AccessDeniedHttpException;
31 | use GlpiPlugin\Manageentities\Cri;
32 | use GlpiPlugin\Manageentities\Config;
33 | use GlpiPlugin\Manageentities\GenerateCRI;
34 |
35 | Session::checkLoginUser();
36 |
37 | $GenerateCri = new GenerateCri();
38 | $Cri = new Cri();
39 | $ticket = new Ticket();
40 |
41 | if (count($_SESSION["glpiactiveentities"]) > 1
42 | && isset($_GET['active_entity'])) {
43 |
44 | if (!isset($_POST["is_recursive"])) {
45 | $_POST["is_recursive"] = 0;
46 | }
47 | if (Session::changeActiveEntities($_GET["active_entity"], $_POST["is_recursive"])) {
48 | if ($_GET["active_entity"] == $_SESSION["glpiactive_entity"]) {
49 | Html::redirect(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
50 | }
51 | }
52 | }
53 |
54 | if (isset($_POST['generatecri'])) {
55 | if (Session::haveRight('ticket', CREATE)) {
56 |
57 | $ko = $GenerateCri->checkMandatoryFields($_POST);
58 | if (!$ko) {
59 | $ticket_id = $GenerateCri->createTicketAndAssociateContract($_POST);
60 | if ($ticket_id) {
61 | $GenerateCri->createTasks($_POST, $ticket_id);
62 | $config = Config::getInstance();
63 | $ticket->update(['id' => $ticket_id,
64 | 'status' => $config->getField('ticket_state')]);
65 | if (isset($_POST['description-undone']) && $_POST['description-undone'] != '') {
66 | $_POST['content'] = $_POST['description-undone'];
67 | $GenerateCri->createTicketTaskUndone($_POST, $ticket_id);
68 | }
69 | // $_POST['download'] = true;
70 | $GenerateCri->generateCri($_POST, $ticket_id, $Cri);
71 | if (!$config->getField('get_pdf_cri')) {
72 | Html::back();
73 | }
74 | }
75 | } else {
76 | Html::back();
77 | }
78 |
79 |
80 | } else {
81 | throw new AccessDeniedHttpException();
82 | }
83 |
84 | } else if (isset($_GET['download'])) {
85 | $ticket_id = $_GET['tickets_id'];
86 | $GenerateCri->generateCri($_POST, $ticket_id, $Cri);
87 | } else {
88 | Html::header(__('Entities portal', 'manageentities'), '', "helpdesk", GenerateCri::class);
89 | $ticket->fields['itilcategories_id'] = $_POST['itilcategories_id'] ?? 0;
90 | $ticket->fields['type'] = $_POST['type'] ?? '';
91 | $_SESSION['glpiactive_entity'] = $_POST['entities_id'] ?? 0;
92 | $_SESSION['glpiactive_entity'] = $_POST['entities_id'] ?? 0;
93 |
94 | $GenerateCri->showWizard($ticket, $_SESSION['glpiactive_entity']);
95 | Html::footer();
96 |
97 | }
98 |
99 | if (Session::getCurrentInterface() == 'central') {
100 | Html::footer();
101 | } else {
102 | Html::helpFooter();
103 | }
104 |
--------------------------------------------------------------------------------
/ajax/tickettask.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 |
31 | use Ramsey\Uuid\Uuid;
32 |
33 | Html::header_nocache();
34 | Session::checkLoginUser();
35 | header("Content-Type: text/html; charset=UTF-8");
36 |
37 | $tickettask = new TicketTask();
38 |
39 | if (isset($_POST['tickets_id']) && isset($_POST['tickettasks_id']) && $tickettask->getFromDB($_POST['tickettasks_id'])) {
40 | switch ($_POST ['action']) {
41 | // case "showCloneTicketTask" :
42 | // $rand = mt_rand();
43 | // echo ' | ';
44 | // echo '';
45 | // echo " ";
46 | // $value = $tickettask->fields['date'];
47 | // if (!empty($tickettask->fields['begin'])) {
48 | // $value = date('Y-m-d H:i:s', strtotime($tickettask->fields['begin'] . ' + 1 DAY'));
49 | // }
50 | // $randDate = Html::showDateTimeField('new_date', ['value' => $value,
51 | // 'rand' => $rand,
52 | // 'mintime' => $CFG_GLPI["planning_begin"],
53 | // 'maxtime' => $CFG_GLPI["planning_end"]]);
54 | // $params = json_encode(['root_doc' => $CFG_GLPI['root_doc'],
55 | //// 'new_date_id' => 'showdate' . $randDate,
56 | // 'tickets_id' => $_POST['tickets_id'],
57 | // 'tickettasks_id' => $_POST['tickettasks_id']]);
58 | // $tickettask_id = $_POST['tickettasks_id'];
59 | // echo "";
60 | // echo "";
62 | //
63 | // echo "";
64 | // echo ' ';
65 | // echo ' |
';
66 | // break;
67 |
68 | case "cloneTicketTask":
69 | header('Content-Type: application/json; charset=UTF-8"');
70 |
71 | if (isset($_POST['new_date_value']) && !empty($_POST['new_date_value'])) {
72 | $tickettask->fields['begin'] = $_POST['new_date_value'];
73 |
74 | unset($tickettask->fields['end']);
75 | unset($tickettask->fields['id']);
76 | $tickettask->fields['date'] = date("Y-m-d H:i:s", time());
77 | $tickettask->fields['content'] = addslashes($tickettask->fields['content']);
78 | $tickettask->fields['plan'] = ['begin' => $tickettask->fields['begin'],
79 | '_duration' => $tickettask->fields['actiontime'],
80 | 'users_id' => $tickettask->fields['users_id_tech']];
81 | $tickettask->fields['uuid'] = Uuid::uuid4();
82 |
83 | if ($id = $tickettask->add($tickettask->fields)) {
84 | echo json_encode(['tickettasks_id' => $id]);
85 | }
86 | }
87 | break;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/public/lib/echarts/theme/sakura.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | (function(root, factory) {
21 | if (typeof define === 'function' && define.amd) {
22 | // AMD. Register as an anonymous module.
23 | define(['exports', 'echarts'], factory);
24 | } else if (
25 | typeof exports === 'object' &&
26 | typeof exports.nodeName !== 'string'
27 | ) {
28 | // CommonJS
29 | factory(exports, require('echarts/lib/echarts'));
30 | } else {
31 | // Browser globals
32 | factory({}, root.echarts);
33 | }
34 | })(this, function(exports, echarts) {
35 | var log = function(msg) {
36 | if (typeof console !== 'undefined') {
37 | console && console.error && console.error(msg);
38 | }
39 | };
40 | if (!echarts) {
41 | log('ECharts is not Loaded');
42 | return;
43 | }
44 |
45 | var colorPalette = [
46 | '#e52c3c',
47 | '#f7b1ab',
48 | '#fa506c',
49 | '#f59288',
50 | '#f8c4d8',
51 | '#e54f5c',
52 | '#f06d5c',
53 | '#e54f80',
54 | '#f29c9f',
55 | '#eeb5b7'
56 | ];
57 |
58 | var theme = {
59 | color: colorPalette,
60 |
61 | title: {
62 | textStyle: {
63 | fontWeight: 'normal',
64 | color: '#e52c3c'
65 | }
66 | },
67 |
68 | visualMap: {
69 | color: ['#e52c3c', '#f7b1ab']
70 | },
71 |
72 | dataRange: {
73 | color: ['#e52c3c', '#f7b1ab']
74 | },
75 |
76 | candlestick: {
77 | itemStyle: {
78 | color: '#e52c3c',
79 | color0: '#f59288'
80 | },
81 | lineStyle: {
82 | width: 1,
83 | color: '#e52c3c',
84 | color0: '#f59288'
85 | },
86 | areaStyle: {
87 | color: '#fa506c',
88 | color0: '#f8c4d8'
89 | }
90 | },
91 |
92 | map: {
93 | itemStyle: {
94 | color: '#e52c3c',
95 | borderColor: '#fff',
96 | borderWidth: 1
97 | },
98 | areaStyle: {
99 | color: '#ccc'
100 | },
101 | label: {
102 | color: 'rgba(139,69,19,1)',
103 | show: false
104 | }
105 | },
106 |
107 | graph: {
108 | itemStyle: {
109 | color: '#f2385a'
110 | },
111 | nodeStyle: {
112 | brushType: 'both',
113 | strokeColor: '#e54f5c'
114 | },
115 | linkStyle: {
116 | color: '#f2385a',
117 | strokeColor: '#e54f5c'
118 | },
119 | label: {
120 | color: '#f2385a',
121 | show: false
122 | }
123 | },
124 |
125 | gauge: {
126 | axisLine: {
127 | lineStyle: {
128 | color: [
129 | [0.2, '#e52c3c'],
130 | [0.8, '#f7b1ab'],
131 | [1, '#fa506c']
132 | ],
133 | width: 8
134 | }
135 | }
136 | }
137 | };
138 |
139 | echarts.registerTheme('sakura', theme);
140 | });
141 |
--------------------------------------------------------------------------------
/src/Dropdown.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | if (!defined('GLPI_ROOT')) {
33 | die("Sorry. You can't access directly to this file");
34 | }
35 |
36 | class Dropdown extends \Dropdown
37 | {
38 |
39 | static $rightname = 'plugin_manageentities';
40 |
41 | //Empty value displayed in a dropdown
42 | const EMPTY_VALUE = '-----';
43 |
44 | /**
45 | * Dropdown numbers
46 | *
47 | * @param $myname select name
48 | * @param $options array of additionnal options :
49 | * - value default value (default 0)
50 | * - rand random value
51 | * - min min value (default 0)
52 | * - max max value (default 100)
53 | * - step step used (default 1)
54 | * - toadd array of values to add at the beginning
55 | * - unit string unit to used
56 | * - display boolean if false get string
57 | * - width specific width needed (default 80%)
58 | * - on_change string / value to transmit to "onChange"
59 | * - used array / Already used items ID: not to display in dropdown (default empty)
60 | **@since version 0.84
61 | *
62 | */
63 | static function showNumber($myname, $options = [])
64 | {
65 | global $CFG_GLPI;
66 |
67 | $p['value'] = 0;
68 | $p['rand'] = mt_rand();
69 | $p['min'] = 0;
70 | $p['max'] = 100;
71 | $p['step'] = 1;
72 | $p['toadd'] = [];
73 | $p['unit'] = '';
74 | $p['display'] = true;
75 | $p['width'] = '';
76 | $p['on_change'] = '';
77 | $p['used'] = [];
78 |
79 | if (is_array($options) && count($options)) {
80 | foreach ($options as $key => $val) {
81 | $p[$key] = $val;
82 | }
83 | }
84 | if (($p['value'] < $p['min']) && !isset($p['toadd'][$p['value']])) {
85 | $p['value'] = $p['min'];
86 | }
87 |
88 | $field_id = \Html::cleanId("dropdown_" . $myname . $p['rand']);
89 | if (!isset($p['toadd'][$p['value']])) {
90 | $valuename = self::getValueWithUnit($p['value'], $p['unit']);
91 | } else {
92 | $valuename = $p['toadd'][$p['value']];
93 | }
94 | $param = [
95 | 'value' => $p['value'],
96 | 'valuename' => $valuename,
97 | 'width' => $p['width'],
98 | 'on_change' => $p['on_change'],
99 | 'used' => $p['used'],
100 | 'unit' => $p['unit'],
101 | 'min' => $p['min'],
102 | 'max' => $p['max'],
103 | 'step' => $p['step'],
104 | 'toadd' => $p['toadd']
105 | ];
106 |
107 | $out = \Html::jsAjaxDropdown(
108 | $myname,
109 | $field_id,
110 | PLUGIN_MANAGEENTITIES_WEBDIR . "/ajax/getDropdownNumber.php",
111 | $param
112 | );
113 |
114 | if ($p['display']) {
115 | echo $out;
116 | return $p['rand'];
117 | }
118 | return $out;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/install/update_210_211.php:
--------------------------------------------------------------------------------
1 | .
28 | --------------------------------------------------------------------------
29 | */
30 |
31 | /**
32 | * Update from 2.1.0 to 2.1.1
33 | *
34 | * @return bool for success (will die for most error)
35 | * */
36 | function update210to211() {
37 | global $DB;
38 |
39 | $migration = new Migration(211);
40 |
41 | $migration->addField('glpi_plugin_manageentities_configs', 'choice_intervention', 'integer', array('value' => NULL));
42 | $migration->addField('glpi_plugin_manageentities_configs', 'contract_states', 'text', array('value' => NULL));
43 | $migration->addField('glpi_plugin_manageentities_configs', 'business_id', 'text', array('value' => NULL));
44 |
45 | $migration->addField('glpi_plugin_manageentities_preferences', 'contract_states', 'text', array('value' => NULL));
46 | $migration->addField('glpi_plugin_manageentities_preferences', 'business_id', 'text', array('value' => NULL));
47 | $migration->addField('glpi_plugin_manageentities_preferences', 'companies_id', 'text', array('value' => NULL));
48 |
49 | $migration->addField('glpi_plugin_manageentities_contractdays', 'comment', 'text');
50 | $migration->addField('glpi_plugin_manageentities_contracts', 'refacturable_costs', 'bool', array('value' => '0'));
51 |
52 |
53 | $query_businesscontacts = "
54 | CREATE TABLE IF NOT EXISTS `glpi_plugin_manageentities_businesscontacts` (
55 | `id` int(11) NOT NULL auto_increment,
56 | `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)',
57 | `entities_id` int(11) NOT NULL default '0',
58 | `is_default` tinyint(1) NOT NULL default '0',
59 | PRIMARY KEY (`id`),
60 | UNIQUE KEY `unicity` (`users_id`,`entities_id`),
61 | KEY `users_id` (`users_id`),
62 | KEY `entities_id` (`entities_id`)
63 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
64 | $DB->doQuery($query_businesscontacts, "ADD glpi_plugin_manageentities_businesscontacts");
65 |
66 |
67 | $query_companies = "
68 | CREATE TABLE IF NOT EXISTS `glpi_plugin_manageentities_companies` (
69 | `id` int(11) NOT NULL auto_increment,
70 | `name` varchar(255) collate utf8_unicode_ci default NULL,
71 | `address` text collate utf8_unicode_ci COMMENT 'address of the company shown on CRI',
72 | `entity_id` text default NULL,
73 | `recursive` int(11) default 0,
74 | `logo_id` int(11) default 0 COMMENT 'RELATION to glpi_documents',
75 | PRIMARY KEY (`id`),
76 | KEY `logo_id` (`logo_id`)
77 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
78 | $DB->doQuery($query_companies, "ADD glpi_plugin_manageentities_companies");
79 |
80 | if ($DB->fieldExists("glpi_plugin_manageentities_configs", "company_address")) {
81 | $dbu = new DbUtils();
82 | $datas = $dbu->getAllDataFromTable("glpi_plugin_manageentities_configs");
83 | $data = reset($datas);
84 | $DB->doQuery("INSERT INTO `glpi_plugin_manageentities_companies`(`address`, `entity_id`, `recursive`) VALUES ('" . $data['company_address'] . "', 0, 1)", "Migration company_address");
85 |
86 | $migration->dropField("glpi_plugin_manageentities_configs", "company_address");
87 | }
88 |
89 |
90 | $migration->executeMigration();
91 |
92 | return true;
93 | }
94 |
--------------------------------------------------------------------------------
/ajax/entity.tabs.php:
--------------------------------------------------------------------------------
1 | .
26 | --------------------------------------------------------------------------
27 | // */
28 |
29 | use GlpiPlugin\Accounts\Account_Item;
30 | use GlpiPlugin\Manageentities\Cri;
31 | use GlpiPlugin\Manageentities\CriDetail;
32 | use GlpiPlugin\Manageentities\Followup;
33 | use GlpiPlugin\Manageentities\Entity;
34 | use GlpiPlugin\Manageentities\Contact;
35 | use GlpiPlugin\Manageentities\Contract;
36 |
37 | define('GLPI_ROOT', '../../..');
38 | header("Content-Type: text/html; charset=UTF-8");
39 | Html::header_nocache();
40 |
41 | $entity = new \Entity();
42 | $ManagementitiesEntity = new Entity();
43 | $Contact = new Contact();
44 | $Contract = new Contract();
45 | $Cri = new Cri();
46 | $CriDetail = new CriDetail();
47 | $followUp = new Followup();
48 |
49 | if (!isset($_POST['plugin_manageentities_tab'])) {
50 | $_POST['plugin_manageentities_tab'] = $_SESSION['glpi_plugin_manageentities_tab'];
51 | }
52 |
53 | if (Session::getCurrentInterface() != 'helpdesk') {
54 | $entities = $_SESSION["glpiactiveentities"];
55 | } else {
56 | $entities = [$_SESSION["glpiactive_entity"]];
57 | }
58 |
59 | switch ($_POST['plugin_manageentities_tab']) {
60 | case "follow-up" :
61 | $_SESSION['glpi_plugin_manageentities_tab'] = "follow-up";
62 | $followUp->showCriteriasForm($_POST);
63 | $followUp->showFollowUp($entities, $_POST);
64 | break;
65 | case "description" :
66 | $_SESSION['glpi_plugin_manageentities_tab'] = "description";
67 | $ManagementitiesEntity->showDescription($entities);
68 | $Contact->showContacts($entities);
69 | break;
70 | case "tickets" :
71 | $_SESSION['glpi_plugin_manageentities_tab'] = "tickets";
72 | // $ManagementitiesEntity->showTickets($entities);
73 | break;
74 | case "reports":
75 | $_SESSION['glpi_plugin_manageentities_tab'] = "reports";
76 | $CriDetail->showReports(0, 0, $entities);
77 | break;
78 | case "documents":
79 | $_SESSION['glpi_plugin_manageentities_tab'] = "documents";
80 | if (Session::haveRight("Document", READ) && $entity->can($entities, READ)) {
81 | Document_Item::showForItem($entity);
82 | }
83 | break;
84 | case "contract":
85 | $_SESSION['glpi_plugin_manageentities_tab'] = "contract";
86 | if (Session::haveRight("Contract", READ)) {
87 | $Contract->showContracts($entities);
88 | }
89 | break;
90 | case "accounts":
91 | $_SESSION['glpi_plugin_manageentities_tab'] = "accounts";
92 | Account_Item::showForItem($entities);
93 | break;
94 | case "all":
95 | $_SESSION['glpi_plugin_manageentities_tab'] = "all";
96 | $ManagementitiesEntity->showDescription($entities);
97 | $Contact->showContacts($entities);
98 | // $ManagementitiesEntity->showTickets($entities);
99 | if ($Cri->canView()) {
100 | $CriDetail->showReports(0, 0, $entities);
101 | }
102 | if (Session::haveRight("Document", READ) && $entity->can($entities, READ)) {
103 | Document_Item::showForItem($entity);
104 | }
105 | if (Session::haveRight("Contract", READ)) {
106 | $Contract->showContracts($entities);
107 | }
108 |
109 | break;
110 | default :
111 | break;
112 | }
113 |
114 | ?>
115 |
--------------------------------------------------------------------------------
/src/ContractState.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | use CommonDropdown;
33 | use DbUtils;
34 |
35 | use Session;
36 |
37 | if (!defined('GLPI_ROOT')) {
38 | die("Sorry. You can't access directly to this file");
39 | }
40 |
41 | class ContractState extends CommonDropdown
42 | {
43 |
44 | static $rightname = 'plugin_manageentities';
45 |
46 | static function getTypeName($nb = 0)
47 | {
48 | return _n('State of contract', 'States of contracts', $nb, 'manageentities');
49 | }
50 |
51 | static function canView(): bool
52 | {
53 | return Session::haveRight(self::$rightname, READ);
54 | }
55 |
56 | static function canCreate(): bool
57 | {
58 | return Session::HaveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]);
59 | }
60 |
61 | function getAdditionalFields()
62 | {
63 | return [
64 | [
65 | 'name' => 'is_active',
66 | 'label' => __('Active'),
67 | 'type' => 'bool'
68 | ],
69 | [
70 | 'name' => 'is_closed',
71 | 'label' => __('Closed'),
72 | 'type' => 'bool'
73 | ],
74 | [
75 | 'name' => 'color',
76 | 'label' => __('Color', 'manageentities'),
77 | 'type' => 'text'
78 | ],
79 | ];
80 | }
81 |
82 | function rawSearchOptions()
83 | {
84 | $tab = parent::rawSearchOptions();
85 |
86 | $tab[] = [
87 | 'id' => '14',
88 | 'table' => $this->getTable(),
89 | 'field' => 'is_active',
90 | 'name' => __('Active'),
91 | 'datatype' => 'bool'
92 | ];
93 |
94 | $tab[] = [
95 | 'id' => '15',
96 | 'table' => $this->getTable(),
97 | 'field' => 'is_closed',
98 | 'name' => __('Closed'),
99 | 'datatype' => 'bool'
100 | ];
101 |
102 | $tab[] = [
103 | 'id' => '17',
104 | 'table' => $this->getTable(),
105 | 'field' => 'color',
106 | 'name' => __('Color', 'manageentities'),
107 | 'datatype' => 'bool'
108 | ];
109 |
110 | return $tab;
111 | }
112 |
113 | public function prepareInputForAdd($input)
114 | {
115 | return $this->checkColor($input);
116 | }
117 |
118 | public function prepareInputForUpdate($input)
119 | {
120 | return $this->checkColor($input);
121 | }
122 |
123 | function checkColor($input)
124 | {
125 | if (!preg_match('/#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?\b/', $input['color'])) {
126 | Session::addMessageAfterRedirect(__('Color field is not correct', 'manageentities'), true, ERROR);
127 | return [];
128 | }
129 | return $input;
130 | }
131 |
132 | static function getOpenedStates()
133 | {
134 | $out = [];
135 | $dbu = new DbUtils();
136 | $data = $dbu->getAllDataFromTable('glpi_plugin_manageentities_contractstates', ["`is_active`" => 1]);
137 | if (!empty($data)) {
138 | foreach ($data as $val) {
139 | $out[] = $val['id'];
140 | }
141 | }
142 |
143 | return $out;
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/ajax/updateDocumentList.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 |
31 | use GlpiPlugin\Manageentities\AddElementsModel;
32 | use GlpiPlugin\Manageentities\AddElementsView;
33 |
34 | header("Content-Type: text/html; charset=UTF-8");
35 | Html::header_nocache();
36 | Session::checkCentralAccess();
37 |
38 | if (!defined('GLPI_ROOT')) {
39 | die("Can not acces directly to this file");
40 | }
41 |
42 | $val = "";
43 |
44 | $val .= "";
45 | $val .= "| ";
46 | $val .= __("Add a document");
47 | $val .= " | ";
48 | $val .= "";
49 | $root_manage = PLUGIN_MANAGEENTITIES_WEBDIR;
50 | $val .= "";
52 | $val .= "";
53 | $val .= " | ";
54 | $val .= "
";
55 | $ele = new AddElementsView();
56 | $val .= $ele->showListPDFcontract(false);
57 |
58 | $pModel = AddElementsModel::getInstance();
59 | $srcImg = "";
60 | $alertTitle = "";
61 |
62 | while (!isset($_SESSION["manageentities"]["add_doc_status"]["result"])) {
63 |
64 | }
65 | $infos = $_SESSION["manageentities"]["add_doc_status"];
66 | unset($_SESSION["manageentities"]["add_doc_status"]);
67 | $message = $infos["message"];
68 | if ($infos["result"] == Status::ADDED) {
69 | $messageType = Messages::MESSAGE_INFO;
70 | } else {
71 | $messageType = Messages::MESSAGE_ERROR;
72 | }
73 | switch ($messageType) {
74 | case Messages::MESSAGE_ERROR:
75 | $srcImg = "ti ti-alert-triangle";
76 | $color = "orange";
77 | $alertTitle = $pModel->getMessage("message_error");
78 | break;
79 | case Messages::MESSAGE_INFO:
80 | default:
81 | $srcImg = "ti ti-info-circle";
82 | $color = "forestgreen";
83 | $alertTitle = $pModel->getMessage("message_info");
84 | break;
85 | }
86 | //$this->showHeaderJS();
87 |
88 | //$val.= " if ($('#alert-message').val()){
89 | // $('#alert-message').val('');
90 | // }";
91 | //$val .= Html::scriptBlock(" if ($('#alert-message').val()){
92 | // $('#alert-message').val('');
93 | // }");
94 | ////$this->closeFormJS();
95 |
96 | //$val.= "" . $message . "
";
97 |
98 | //$this->showHeaderJS();
99 | $val .= Html::scriptBlock("
100 | $( \"body\" ).append(\" $message
\");
101 | var mTitle = \" " . $alertTitle . " \";
102 | $( '#alert-message' ).dialog({
103 | autoOpen: false,
104 | height: " . 150 . ",
105 | width: " . 300 . ",
106 | modal: true,
107 | open: function (){
108 | $(this)
109 | .parent()
110 | .children('.ui-dialog-titlebar')
111 | .html(mTitle);
112 | },
113 | buttons: {
114 | 'ok': function() {
115 | $( this ).dialog( 'close' );
116 | }
117 | },
118 | beforeClose: function(event) {
119 | $('#alert-message').remove();
120 | return false;
121 | }
122 | });
123 | $('#alert-message').dialog('open');");
124 |
125 |
126 | //$this->closeFormJS();
127 | echo $val;
128 |
--------------------------------------------------------------------------------
/install/sql/empty-1.5.0.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_contracts`;
2 | CREATE TABLE `glpi_plugin_manageentity_contracts` (
3 | `ID` int(11) NOT NULL auto_increment,
4 | `FK_contracts` int(11) NOT NULL default '0',
5 | `FK_entities` int(11) NOT NULL default '0',
6 | `isdefault` int(11) NOT NULL default '0',
7 | PRIMARY KEY (`ID`),
8 | UNIQUE KEY `FK_contracts` (`FK_contracts`,`FK_entities`),
9 | KEY `FK_contracts_2` (`FK_contracts`),
10 | KEY `FK_entities` (`FK_entities`)
11 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
12 |
13 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_documents`;
14 | CREATE TABLE `glpi_plugin_manageentity_documents` (
15 | `ID` int(11) NOT NULL auto_increment,
16 | `FK_documents` int(11) NOT NULL default '0',
17 | `FK_entities` int(11) NOT NULL default '0',
18 | PRIMARY KEY (`ID`),
19 | UNIQUE KEY `FK_documents` (`FK_documents`,`FK_entities`),
20 | KEY `FK_documents_2` (`FK_documents`),
21 | KEY `FK_entities` (`FK_entities`)
22 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
23 |
24 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_contacts`;
25 | CREATE TABLE `glpi_plugin_manageentity_contacts` (
26 | `ID` int(11) NOT NULL auto_increment,
27 | `FK_contacts` int(11) NOT NULL default '0',
28 | `FK_entities` int(11) NOT NULL default '0',
29 | `isdefault` int(11) NOT NULL default '0',
30 | PRIMARY KEY (`ID`),
31 | UNIQUE KEY `FK_contacts` (`FK_contacts`,`FK_entities`),
32 | KEY `FK_contacts_2` (`FK_contacts`),
33 | KEY `FK_entities` (`FK_entities`)
34 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
35 |
36 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_profiles`;
37 | CREATE TABLE `glpi_plugin_manageentity_profiles` (
38 | `ID` int(11) NOT NULL auto_increment,
39 | `name` varchar(255) collate utf8_unicode_ci default NULL,
40 | `manageentity` char(1) default NULL,
41 | `cri` char(1) default NULL,
42 | PRIMARY KEY (`ID`),
43 | KEY `name` (`name`)
44 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
45 |
46 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_preference`;
47 | CREATE TABLE `glpi_plugin_manageentity_preference` (
48 | `ID` int(11) NOT NULL auto_increment,
49 | `user_id` int(11) NOT NULL,
50 | `show` varchar(255) NOT NULL,
51 | PRIMARY KEY (`ID`)
52 | ) ENGINE=MyISAM;
53 |
54 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_config`;
55 | CREATE TABLE `glpi_plugin_manageentity_config` (
56 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
57 | `backup` INT( 11 ) NOT NULL ,
58 | `rubrique` INT( 11 ) NOT NULL
59 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
60 |
61 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_manageentity_critype`;
62 | CREATE TABLE `glpi_dropdown_plugin_manageentity_critype` (
63 | `ID` int(11) NOT NULL auto_increment,
64 | `name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
65 | `comments` text,
66 | PRIMARY KEY (`ID`),
67 | KEY `name` (`name`)
68 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
69 |
70 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_criprice`;
71 | CREATE TABLE `glpi_plugin_manageentity_criprice` (
72 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
73 | `FK_entities` int(11) NOT NULL default '0',
74 | `FK_typecri` INT( 11 ) NOT NULL ,
75 | `price` decimal(20,4) NOT NULL default '0.0000'
76 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
77 |
78 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_dayforcontract`;
79 | CREATE TABLE `glpi_plugin_manageentity_dayforcontract` (
80 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
81 | `FK_entities` int(11) NOT NULL default '0',
82 | `FK_typecri` INT( 11 ) NOT NULL ,
83 | `FK_contracts` INT( 11 ) NOT NULL ,
84 | `nbday` decimal(20,2) default '0.00'
85 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
86 |
87 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_critechnicians`;
88 | CREATE TABLE `glpi_plugin_manageentity_critechnicians` (
89 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
90 | `FK_ticket` INT( 11 ) NOT NULL ,
91 | `FK_users` INT( 11 ) NOT NULL
92 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
93 |
94 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_cridetails`;
95 | CREATE TABLE `glpi_plugin_manageentity_cridetails` (
96 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
97 | `FK_entities` int(11) NOT NULL default '0',
98 | `date` date default NULL,
99 | `FK_doc` INT( 11 ) NOT NULL ,
100 | `type_cri` INT( 11 ) NOT NULL ,
101 | `withcontract` INT( 11 ) NOT NULL ,
102 | `FK_contracts` INT( 11 ) NOT NULL,
103 | `realtime` decimal(20,2) default '0.00',
104 | `technicians` varchar(255) collate utf8_unicode_ci NOT NULL default ''
105 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
106 |
107 | INSERT INTO `glpi_plugin_manageentity_config` ( `ID`, `backup` , `rubrique`) VALUES ('1', '0','-1');
--------------------------------------------------------------------------------
/src/CriType.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | use CommonDropdown;
33 | use CommonGLPI;
34 | use Session;
35 | use GlpiPlugin\Manageentities\Config;
36 |
37 | if (!defined('GLPI_ROOT')) {
38 | die("Sorry. You can't access directly to this file");
39 | }
40 |
41 | class CriType extends CommonDropdown
42 | {
43 |
44 | static $rightname = 'plugin_manageentities';
45 |
46 | static function getTypeName($nb = 0)
47 | {
48 | return _n('Intervention type', 'Intervention types', $nb, 'manageentities');
49 | }
50 |
51 | static function canCreate(): bool
52 | {
53 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]);
54 | }
55 |
56 | static function canView(): bool
57 | {
58 | $config = Config::getInstance();
59 | if ($config->fields['useprice'] == Config::PRICE) {
60 | return Session::haveRight(self::$rightname, READ);
61 | }
62 | return false;
63 | }
64 |
65 | function rawSearchOptions()
66 | {
67 | $tab = parent::rawSearchOptions();
68 |
69 | $tab[] = [
70 | 'id' => '12',
71 | 'table' => 'glpi_plugin_manageentities_contractdays',
72 | 'field' => 'name',
73 | 'forcegroupby' => true,
74 | 'name' => ContractDay::getTypeName(),
75 | 'datatype' => 'itemlink',
76 | 'joinparams' => [
77 | 'condition' =>
78 | "AND REFTABLE.`entities_id` IN ('" . implode("','", $_SESSION["glpiactiveentities"]) . "')",
79 | 'beforejoin' =>
80 | [
81 | 'table' => 'glpi_plugin_manageentities_criprices',
82 | 'joinparams' => ['jointype' => "child"]
83 | ]
84 | ]
85 | ];
86 |
87 | $tab[] = [
88 | 'id' => '13',
89 | 'table' => 'glpi_plugin_manageentities_criprices',
90 | 'field' => 'price',
91 | 'datatype' => 'number',
92 | 'forcegroupby' => true,
93 | 'name' => __('Daily rate', 'manageentities'),
94 | /*'joinparams' => ['jointype' => "child",
95 | 'condition' => "AND NEWTABLE.`entities_id` IN ('".implode("','", $_SESSION["glpiactiveentities"])."')"]*/
96 | ];
97 | /* OLD :
98 |
99 | $tab[13]['table'] = 'glpi_plugin_manageentities_criprices';
100 | $tab[13]['field'] = 'price';
101 | $tab[13]['datatype'] = 'number';
102 | $tab[13]['forcegroupby'] = true;
103 | $tab[13]['name'] = __('Daily rate', 'manageentities');
104 | $tab[13]['joinparams'] = ['jointype' => "child",
105 | 'condition' => "AND NEWTABLE.`entities_id` IN ('".implode("','", $_SESSION["glpiactiveentities"])."')"];
106 | */
107 |
108 | return $tab;
109 | }
110 |
111 | function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
112 | {
113 | if (!$withtemplate) {
114 | switch ($item->getType()) {
115 | case CriType::class :
116 | return self::createTabEntry(CriType::getTypeName(1));
117 | }
118 | }
119 | return '';
120 | }
121 |
122 |
123 | static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
124 | {
125 | $criprice = new CriPrice();
126 | if ($item->getType() == CriType::class) {
127 | $criprice->showForCriType($item);
128 | }
129 | return true;
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/install/sql/empty-1.5.1.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_contracts`;
2 | CREATE TABLE `glpi_plugin_manageentity_contracts` (
3 | `ID` int(11) NOT NULL auto_increment,
4 | `FK_contracts` int(11) NOT NULL default '0',
5 | `FK_entities` int(11) NOT NULL default '0',
6 | `isdefault` int(11) NOT NULL default '0',
7 | PRIMARY KEY (`ID`),
8 | UNIQUE KEY `FK_contracts` (`FK_contracts`,`FK_entities`),
9 | KEY `FK_contracts_2` (`FK_contracts`),
10 | KEY `FK_entities` (`FK_entities`)
11 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
12 |
13 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_documents`;
14 | CREATE TABLE `glpi_plugin_manageentity_documents` (
15 | `ID` int(11) NOT NULL auto_increment,
16 | `FK_documents` int(11) NOT NULL default '0',
17 | `FK_entities` int(11) NOT NULL default '0',
18 | PRIMARY KEY (`ID`),
19 | UNIQUE KEY `FK_documents` (`FK_documents`,`FK_entities`),
20 | KEY `FK_documents_2` (`FK_documents`),
21 | KEY `FK_entities` (`FK_entities`)
22 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
23 |
24 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_contacts`;
25 | CREATE TABLE `glpi_plugin_manageentity_contacts` (
26 | `ID` int(11) NOT NULL auto_increment,
27 | `FK_contacts` int(11) NOT NULL default '0',
28 | `FK_entities` int(11) NOT NULL default '0',
29 | `isdefault` int(11) NOT NULL default '0',
30 | PRIMARY KEY (`ID`),
31 | UNIQUE KEY `FK_contacts` (`FK_contacts`,`FK_entities`),
32 | KEY `FK_contacts_2` (`FK_contacts`),
33 | KEY `FK_entities` (`FK_entities`)
34 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
35 |
36 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_profiles`;
37 | CREATE TABLE `glpi_plugin_manageentity_profiles` (
38 | `ID` int(11) NOT NULL auto_increment,
39 | `name` varchar(255) collate utf8_unicode_ci default NULL,
40 | `manageentity` char(1) default NULL,
41 | `cri` char(1) default NULL,
42 | PRIMARY KEY (`ID`),
43 | KEY `name` (`name`)
44 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
45 |
46 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_preference`;
47 | CREATE TABLE `glpi_plugin_manageentity_preference` (
48 | `ID` int(11) NOT NULL auto_increment,
49 | `user_id` int(11) NOT NULL,
50 | `show` varchar(255) NOT NULL,
51 | PRIMARY KEY (`ID`)
52 | ) ENGINE=MyISAM;
53 |
54 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_config`;
55 | CREATE TABLE `glpi_plugin_manageentity_config` (
56 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
57 | `backup` INT( 11 ) NOT NULL ,
58 | `rubrique` INT( 11 ) NOT NULL,
59 | `hourbyday` INT( 11 ) NOT NULL
60 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
61 |
62 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_manageentity_critype`;
63 | CREATE TABLE `glpi_dropdown_plugin_manageentity_critype` (
64 | `ID` int(11) NOT NULL auto_increment,
65 | `name` varchar(255) collate utf8_unicode_ci NOT NULL default '',
66 | `comments` text,
67 | PRIMARY KEY (`ID`),
68 | KEY `name` (`name`)
69 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
70 |
71 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_criprice`;
72 | CREATE TABLE `glpi_plugin_manageentity_criprice` (
73 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
74 | `FK_entities` int(11) NOT NULL default '0',
75 | `FK_typecri` INT( 11 ) NOT NULL ,
76 | `price` decimal(20,4) NOT NULL default '0.0000'
77 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
78 |
79 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_dayforcontract`;
80 | CREATE TABLE `glpi_plugin_manageentity_dayforcontract` (
81 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
82 | `FK_entities` int(11) NOT NULL default '0',
83 | `FK_typecri` INT( 11 ) NOT NULL ,
84 | `FK_contracts` INT( 11 ) NOT NULL ,
85 | `nbday` decimal(20,2) default '0.00'
86 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
87 |
88 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_critechnicians`;
89 | CREATE TABLE `glpi_plugin_manageentity_critechnicians` (
90 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
91 | `FK_ticket` INT( 11 ) NOT NULL ,
92 | `FK_users` INT( 11 ) NOT NULL
93 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
94 |
95 | DROP TABLE IF EXISTS `glpi_plugin_manageentity_cridetails`;
96 | CREATE TABLE `glpi_plugin_manageentity_cridetails` (
97 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
98 | `FK_entities` int(11) NOT NULL default '0',
99 | `date` date default NULL,
100 | `FK_doc` INT( 11 ) NOT NULL ,
101 | `type_cri` INT( 11 ) NOT NULL ,
102 | `withcontract` INT( 11 ) NOT NULL ,
103 | `FK_contracts` INT( 11 ) NOT NULL,
104 | `realtime` decimal(20,2) default '0.00',
105 | `technicians` varchar(255) collate utf8_unicode_ci NOT NULL default ''
106 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
107 |
108 | INSERT INTO `glpi_plugin_manageentity_config` (`ID`,`backup`,`rubrique`,`hourbyday`) VALUES ('1', '0','-1','8');
--------------------------------------------------------------------------------
/public/lib/echarts/theme/mint.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | (function(root, factory) {
21 | if (typeof define === 'function' && define.amd) {
22 | // AMD. Register as an anonymous module.
23 | define(['exports', 'echarts'], factory);
24 | } else if (
25 | typeof exports === 'object' &&
26 | typeof exports.nodeName !== 'string'
27 | ) {
28 | // CommonJS
29 | factory(exports, require('echarts/lib/echarts'));
30 | } else {
31 | // Browser globals
32 | factory({}, root.echarts);
33 | }
34 | })(this, function(exports, echarts) {
35 | var log = function(msg) {
36 | if (typeof console !== 'undefined') {
37 | console && console.error && console.error(msg);
38 | }
39 | };
40 | if (!echarts) {
41 | log('ECharts is not Loaded');
42 | return;
43 | }
44 |
45 | var colorPalette = [
46 | '#8aedd5',
47 | '#93bc9e',
48 | '#cef1db',
49 | '#7fe579',
50 | '#a6d7c2',
51 | '#bef0bb',
52 | '#99e2vb',
53 | '#94f8a8',
54 | '#7de5b8',
55 | '#4dfb70'
56 | ];
57 |
58 | var theme = {
59 | color: colorPalette,
60 |
61 | title: {
62 | textStyle: {
63 | fontWeight: 'normal',
64 | color: '#8aedd5'
65 | }
66 | },
67 |
68 | toolbox: {
69 | color: ['#8aedd5', '#8aedd5', '#8aedd5', '#8aedd5']
70 | },
71 |
72 | tooltip: {
73 | backgroundColor: 'rgba(0,0,0,0.5)',
74 | axisPointer: {
75 | // Axis indicator, coordinate trigger effective
76 | type: 'line', // The default is a straight line: 'line' | 'shadow'
77 | lineStyle: {
78 | // Straight line indicator style settings
79 | color: '#8aedd5',
80 | type: 'dashed'
81 | },
82 | crossStyle: {
83 | color: '#8aedd5'
84 | },
85 | shadowStyle: {
86 | // Shadow indicator style settings
87 | color: 'rgba(200,200,200,0.3)'
88 | }
89 | }
90 | },
91 |
92 | // Area scaling controller
93 | dataZoom: {
94 | dataBackgroundColor: '#eee', // Data background color
95 | fillerColor: 'rgba(64,136,41,0.2)', // Fill the color
96 | handleColor: '#408829' // Handle color
97 | },
98 |
99 | dataRange: {
100 | color: ['#93bc92', '#bef0bb']
101 | },
102 |
103 | candlestick: {
104 | itemStyle: {
105 | color: '#8aedd5',
106 | color0: '#7fe579'
107 | },
108 | lineStyle: {
109 | width: 1,
110 | color: '#8aedd5',
111 | color0: '#7fe579'
112 | },
113 | areaStyle: {
114 | color: '#8aedd5',
115 | color0: '#93bc9e'
116 | }
117 | },
118 |
119 | graph: {
120 | itemStyle: {
121 | color: '#8aedd5'
122 | },
123 | linkStyle: {
124 | color: '#93bc9e'
125 | }
126 | },
127 |
128 | map: {
129 | itemStyle: {
130 | color: '#8aedd5'
131 | },
132 | areaStyle: {
133 | color: '#93bc9e'
134 | },
135 | label: {
136 | color: '#cef1db'
137 | }
138 | },
139 |
140 | gauge: {
141 | axisLine: {
142 | lineStyle: {
143 | color: [
144 | [0.2, '#93bc9e'],
145 | [0.8, '#8aedd5'],
146 | [1, '#a6d7c2']
147 | ],
148 | width: 8
149 | }
150 | }
151 | }
152 | };
153 |
154 | echarts.registerTheme('mint', theme);
155 | });
156 |
--------------------------------------------------------------------------------
/front/directhelpdesk.form.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | use GlpiPlugin\Manageentities\DirectHelpdesk;
31 | use GlpiPlugin\Servicecatalog\Main;
32 |
33 | if (Session::haveRight("plugin_manageentities", UPDATE)) {
34 | $direct = new DirectHelpdesk();
35 |
36 | if (isset($_POST["create_ticket"])) {
37 | $ticket = new Ticket();
38 | $items = $_POST["select"];
39 | $sum = 0;
40 | $input['content'] = '';
41 | foreach ($items as $item => $check) {
42 | if ($check == "on") {
43 | $direct = new DirectHelpdesk();
44 | $direct->getFromDB($item);
45 |
46 | $actiontime = $direct->fields['actiontime'];
47 | $sum += $actiontime;
48 | $input['entities_id'] = $_POST["entities_id"];
49 | $input['name'] = __('New intervention', 'manageentities') . " : " . CommonITILObject::getActionTime(
50 | $sum
51 | );
52 | $input['content'] .= Html::convDate(
53 | $direct->fields['date']
54 | ) . " : " . $direct->fields['name'] . " - " . getUserName(
55 | $direct->fields['users_id']
56 | ) . " (" . CommonITILObject::getActionTime($actiontime) . ")
";
57 |
58 | $input['_users_id_assign'][] = $direct->fields['users_id'];
59 | }
60 | }
61 |
62 | $newID = $ticket->add($input);
63 |
64 | foreach ($items as $item => $check) {
65 | if ($check == "on") {
66 | if ($newID > 0) {
67 | $inputd['id'] = $item;
68 | $inputd['is_billed'] = 1;
69 | $inputd['tickets_id'] = $newID;
70 | $direct->update($inputd);
71 | }
72 | }
73 | }
74 |
75 | Html::redirect($ticket->getLinkURL());
76 |
77 | // Html::header(__('Entities portal', 'manageentities'), '', "helpdesk", "DirectHelpdesk::class);
78 | // $options['entities_id'] = $_POST['entities_id'];
79 | // $direct = new DirectHelpdesk();
80 | // $options['content'] = "";
81 | // $options['_created_from_directhelpdesk'] = true;
82 |
83 | // $ticket = new Ticket();
84 | // $ticket->showForm(0, $options);
85 | // Html::footer();
86 | } elseif (isset($_POST["add"])) {
87 | $inter = $direct->add($_POST);
88 |
89 | Html::back();
90 | } elseif (isset($_POST["update"])) {
91 | $direct->check($_POST["id"], UPDATE);
92 | $direct->update($_POST);
93 |
94 | Html::back();
95 | } elseif (isset($_POST["delete"])) {
96 | $direct->delete($_POST, 1);
97 | Html::back();
98 | } else {
99 | $direct->checkGlobal(READ);
100 |
101 | if (Session::getCurrentInterface() == 'central') {
102 | Html::header(__('Entities portal', 'manageentities'), '', "helpdesk", DirectHelpdesk::class);
103 | } else {
104 | if (Plugin::isPluginActive('servicecatalog')) {
105 | Main::showDefaultHeaderHelpdesk(__('Entities portal', 'manageentities'));
106 | } else {
107 | Html::helpHeader(__('Entities portal', 'manageentities'));
108 | }
109 | }
110 | $direct->display($_GET);
111 |
112 | if (Session::getCurrentInterface() == 'central') {
113 | Html::footer();
114 | } else {
115 | Html::helpFooter();
116 | }
117 | }
118 | } else {
119 | Html::header(__('Setup'), '', "config", "plugin");
120 | echo "";
121 | echo "" . __("You don't have permission to perform this action.") . "
";
122 | Html::footer();
123 | }
124 |
--------------------------------------------------------------------------------
/src/TaskCategory.php:
--------------------------------------------------------------------------------
1 | .
27 | --------------------------------------------------------------------------
28 | */
29 |
30 | namespace GlpiPlugin\Manageentities;
31 |
32 | use CommonDBTM;
33 | use CommonGLPI;
34 | use Html;
35 | use Session;
36 | use GlpiPlugin\Manageentities\Config;
37 |
38 | if (!defined('GLPI_ROOT')) {
39 | die("Sorry. You can't access directly to this file");
40 | }
41 |
42 | class TaskCategory extends CommonDBTM
43 | {
44 |
45 | static $rightname = 'dropdown';
46 |
47 | static function getTypeName($nb = 0)
48 | {
49 | return _n('Management of task category', 'Management of task categories', $nb, 'manageentities');
50 | }
51 |
52 | static function canView(): bool
53 | {
54 | return Session::haveRight(self::$rightname, READ);
55 | }
56 |
57 | static function canCreate(): bool
58 | {
59 | return Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, DELETE]);
60 | }
61 |
62 | function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
63 | {
64 | $config = Config::getInstance();
65 |
66 | if ($item->getType() == 'TaskCategory') {
67 | if ($config->fields['hourorday'] == Config::HOUR) {
68 | return self::createTabEntry(__('Entities portal', 'manageentities'));
69 | }
70 | }
71 | return '';
72 | }
73 |
74 | static function getIcon()
75 | {
76 | return "ti ti-user-pentagon";
77 | }
78 |
79 |
80 | static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
81 | {
82 | global $CFG_GLPI;
83 |
84 | if ($item->getType() == 'TaskCategory') {
85 | $ID = $item->getField('id');
86 | $self = new self();
87 |
88 | if (!$self->getFromDBByCrit(['taskcategories_id' => $ID])) {
89 | $self->createAccess($item->getField('id'));
90 | }
91 | $self->showForm($item->getField('id'), [
92 | 'target' =>
93 | PLUGIN_MANAGEENTITIES_WEBDIR . "/front/taskcategory.form.php"
94 | ]);
95 | }
96 | return true;
97 | }
98 |
99 | function createAccess($ID)
100 | {
101 | $this->add([
102 | 'taskcategories_id' => $ID
103 | ]);
104 | }
105 |
106 | function showForm($ID, $options = [])
107 | {
108 | if (!self::canView()) {
109 | return false;
110 | }
111 |
112 | $taskCategory = new \TaskCategory();
113 | if ($ID) {
114 | $this->getFromDBByCrit(['taskcategories_id' => $ID]);
115 | $taskCategory->getFromDB($ID);
116 | $canUpdate = $taskCategory->can($ID, UPDATE);
117 | }
118 |
119 | $rand = mt_rand();
120 |
121 | echo "