-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsetup.php
97 lines (73 loc) · 3.48 KB
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/*
-------------------------------------------------------------------------
LICENSE
This file is part of GestStock plugin for GLPI.
GestStock is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GestStock is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with GestStock. If not, see <http://www.gnu.org/licenses/>.
@package geststock
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2017-2022 GestStock plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link
@since version 1.0.0
--------------------------------------------------------------------------
*/
if (!defined("PLUGIN_GESTSTOCK_UPLOAD_DIR")) {
define("PLUGIN_GESTSTOCK_UPLOAD_DIR", GLPI_PLUGIN_DOC_DIR."/geststock/upload/");
}
function plugin_init_geststock() {
global $PLUGIN_HOOKS,$CFG_GLPI;
$PLUGIN_HOOKS["helpdesk_menu_entry"]['geststock'] = true;
$PLUGIN_HOOKS['csrf_compliant']['geststock'] = true;
Plugin::registerClass('PluginGeststockProfile', ['addtabon' => 'Profile']);
$PLUGIN_HOOKS['pre_item_update']['geststock'] = ['Ticket' => ['PluginGeststockTicket', 'beforeUpdate']];
$PLUGIN_HOOKS['item_update']['geststock'] = ['Ticket' => ['PluginGeststockTicket', 'afterUpdate']];
$plugin = new Plugin();
if ($plugin->isActivated("geststock")) {
$PLUGIN_HOOKS['config_page']['geststock'] = 'front/config.form.php';
}
include_once(Plugin::getPhpDir('geststock')."/inc/reservation.class.php");
if ($plugin->isActivated("simcard")) {
PluginGeststockReservation::registerType('PluginSimcardSimcard');
}
$type = new PluginGeststockReservation();
foreach ($type::$types as $key) {
$mod = $key."Model";
Plugin::registerClass('PluginGeststockSpecification', ['addtabon' => $mod]);
}
$PLUGIN_HOOKS['change_profile']['geststock'] = ['PluginGeststockProfile','initProfile'];
if (Session::getLoginUserID()) {
if (Session::haveRight("plugin_geststock", READ)) {
$PLUGIN_HOOKS['menu_toadd']['geststock'] = ['tools' => 'PluginGeststockMenu'];
Plugin::registerClass('PluginGeststockReservation', ['addtabon' => 'Ticket']);
}
$PLUGIN_HOOKS['use_massive_action']['geststock'] = 1;
}
$PLUGIN_HOOKS['plugin_pdf']['PluginGeststockReservation'] = 'PluginGeststockReservationPDF';
$PLUGIN_HOOKS['post_init']['geststock'] = 'plugin_geststock_postinit';
}
// Get the name and the version of the plugin - Needed
function plugin_version_geststock() {
return ['name' => __('Stock gestion', 'geststock'),
'version' => '2.1.1',
'author' => 'Nelly Mahu-Lasson',
'license' => 'GPLv3+',
'homepage' => 'https://github.com/yllen/geststock',
'page' => "/front/reservation.php",
'minGlpiVersion' => '10.0.3',
'requirements' => ['glpi' => ['min' => '10.0.3',
'max' => '11.0.0']]];
}
function plugin_geststock_check_config() {
return true;
}