-
Notifications
You must be signed in to change notification settings - Fork 35
/
setup.php
108 lines (83 loc) · 4.01 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
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/*
------------------------------------------------------------------------
Barcode
Copyright (C) 2009-2016 by the Barcode plugin Development Team.
https://forge.indepnet.net/projects/barscode
------------------------------------------------------------------------
LICENSE
This file is part of barcode plugin project.
Plugin Barcode 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.
Plugin Barcode 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 Plugin Barcode. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
@package Plugin Barcode
@author David Durieux
@co-author
@copyright Copyright (c) 2009-2016 Barcode plugin Development team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://forge.indepnet.net/projects/barscode
@since 2009
------------------------------------------------------------------------
*/
define ("PLUGIN_BARCODE_VERSION", "2.7.1");
// Minimal GLPI version, inclusive
define('PLUGIN_BARCODE_MIN_GLPI', '10.0.0');
// Maximum GLPI version, exclusive
define('PLUGIN_BARCODE_MAX_GLPI', '10.0.99');
// Init the hooks of the plugins -Needed
function plugin_init_barcode() {
global $PLUGIN_HOOKS;
require_once(__DIR__ . '/vendor/autoload.php');
$PLUGIN_HOOKS['csrf_compliant']['barcode'] = true;
Plugin::registerClass('PluginBarcodeDropdown');
Plugin::registerClass('PluginBarcodeProfile', ['addtabon' => ['Profile']]);
Plugin::registerClass('PluginBarcode');
// Display a menu entry ?
if (Session::haveRight('plugin_barcode_barcode', CREATE)
|| Session::haveRight('plugin_barcode_config', UPDATE)) {
$PLUGIN_HOOKS['pre_item_purge']['barcode']
= ['Profile' => ['PluginBarcodeProfile','cleanProfiles']];
// Massive Action definition
$PLUGIN_HOOKS['use_massive_action']['barcode'] = 1;
$web_dir = '/' . Plugin::getWebDir('barcode', false);
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['title'] = "Search";
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['page'] = $web_dir . '/front/barcode.php';
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['search'] = $web_dir. '/front/barcode.php';
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['add'] = $web_dir. '/front/barcode.form.php';
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['config'] = $web_dir. '/index.php';
$PLUGIN_HOOKS["helpdesk_menu_entry"]['barcode'] = true;
}
// Config page
if (Session::haveRight('config', UPDATE)) {
$PLUGIN_HOOKS['config_page']['barcode'] = 'front/config.php';
}
//Redirect code
//http://localhost/glpi/index.php?redirect=plugin_barcode_2 to form ID 2
$PLUGIN_HOOKS['redirect_page']['barcode'] = 'barcode.form.php';
}
function plugin_version_barcode() {
return [
'name' => 'Barcode',
'shortname' => 'barcode',
'version' => PLUGIN_BARCODE_VERSION,
'license' => 'AGPLv3+',
'author' => '<a href="mailto:[email protected]">David DURIEUX</a> &
Jean Marc GRISARD & Vincent MAZZONI',
'homepage' => 'https://github.com/pluginsGLPI/barcode',
'requirements' => [
'glpi' => [
'min' => PLUGIN_BARCODE_MIN_GLPI,
'max' => PLUGIN_BARCODE_MAX_GLPI,
]
]
];
}