ryxeo-glpi-git / htdocs / front / software.form.php @ 1c14bcc4
Historique | Voir | Annoter | Télécharger (6,14 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: software.form.php 7763 2009-01-06 18:44:50Z moyo $
|
4 |
-------------------------------------------------------------------------
|
5 |
GLPI - Gestionnaire Libre de Parc Informatique
|
6 |
Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
7 |
|
8 |
http://indepnet.net/ http://glpi-project.org
|
9 |
-------------------------------------------------------------------------
|
10 |
|
11 |
LICENSE
|
12 |
|
13 |
This file is part of GLPI.
|
14 |
|
15 |
GLPI is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
17 |
the Free Software Foundation; either version 2 of the License, or
|
18 |
(at your option) any later version.
|
19 |
|
20 |
GLPI is distributed in the hope that it will be useful,
|
21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
GNU General Public License for more details.
|
24 |
|
25 |
You should have received a copy of the GNU General Public License
|
26 |
along with GLPI; if not, write to the Free Software
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
--------------------------------------------------------------------------
|
29 |
*/
|
30 |
|
31 |
// ----------------------------------------------------------------------
|
32 |
// Original Author of file:
|
33 |
// Purpose of file:
|
34 |
// ----------------------------------------------------------------------
|
35 |
|
36 |
|
37 |
|
38 |
$NEEDED_ITEMS=array("computer","software","rulesengine","tracking","document","user","group","link","reservation","infocom","contract","enterprise","rule.softwarecategories"); |
39 |
|
40 |
define('GLPI_ROOT', '..'); |
41 |
include (GLPI_ROOT . "/inc/includes.php"); |
42 |
|
43 |
|
44 |
if(!isset($_GET["ID"])) $_GET["ID"] = ""; |
45 |
if(!isset($_GET["sort"])) $_GET["sort"] = ""; |
46 |
if(!isset($_GET["order"])) $_GET["order"] = ""; |
47 |
if(!isset($_GET["withtemplate"])) $_GET["withtemplate"] = ""; |
48 |
|
49 |
$soft=new Software(); |
50 |
if (isset($_POST["add"])) |
51 |
{ |
52 |
checkRight("software","w"); |
53 |
|
54 |
$newID=$soft->add($_POST); |
55 |
logEvent($newID, "software", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][20]." ".$_POST["name"]."."); |
56 |
glpi_header($_SERVER['HTTP_REFERER']); |
57 |
} |
58 |
else if (isset($_POST["delete"])) |
59 |
{ |
60 |
checkRight("software","w"); |
61 |
|
62 |
if (!empty($_POST["withtemplate"])) |
63 |
$soft->delete($_POST,1); |
64 |
else $soft->delete($_POST); |
65 |
|
66 |
logEvent($_POST["ID"], "software", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][22]); |
67 |
if(!empty($_POST["withtemplate"])) |
68 |
glpi_header($CFG_GLPI["root_doc"]."/front/setup.templates.php"); |
69 |
else
|
70 |
glpi_header($CFG_GLPI["root_doc"]."/front/software.php"); |
71 |
} |
72 |
else if (isset($_POST["restore"])) |
73 |
{ |
74 |
checkRight("software","w"); |
75 |
|
76 |
$soft->restore($_POST); |
77 |
logEvent($_POST["ID"], "software", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][23]); |
78 |
glpi_header($CFG_GLPI["root_doc"]."/front/software.php"); |
79 |
} |
80 |
else if (isset($_POST["purge"]) || isset($_GET["purge"])) |
81 |
{ |
82 |
checkRight("software","w"); |
83 |
|
84 |
if (isset($_POST["purge"])) |
85 |
$input["ID"]=$_POST["ID"]; |
86 |
else
|
87 |
$input["ID"] = $_GET["ID"]; |
88 |
|
89 |
$soft->delete($input,1); |
90 |
logEvent($input["ID"], "software", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][24]); |
91 |
glpi_header($CFG_GLPI["root_doc"]."/front/software.php"); |
92 |
} |
93 |
else if (isset($_POST["update"])) |
94 |
{ |
95 |
checkRight("software","w"); |
96 |
|
97 |
$soft->update($_POST); |
98 |
logEvent($_POST["ID"], "software", 4, "inventory", $_SESSION["glpiname"]." ".$LANG["log"][21]); |
99 |
glpi_header($_SERVER['HTTP_REFERER']); |
100 |
} |
101 |
else
|
102 |
{ |
103 |
checkRight("software","r"); |
104 |
|
105 |
if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1; |
106 |
if (isset($_GET['onglet'])) { |
107 |
$_SESSION['glpi_onglet']=$_GET['onglet']; |
108 |
//glpi_header($_SERVER['HTTP_REFERER']);
|
109 |
} |
110 |
|
111 |
commonHeader($LANG["Menu"][4],$_SERVER['PHP_SELF'],"inventory","software"); |
112 |
|
113 |
|
114 |
if (!empty($_GET["withtemplate"])) { |
115 |
|
116 |
if ($soft->showForm($_SERVER['PHP_SELF'],$_GET["ID"],$_GET["withtemplate"])){ |
117 |
|
118 |
if ($_GET["ID"]>0){ |
119 |
switch($_SESSION['glpi_onglet']){ |
120 |
case 4 : |
121 |
showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",SOFTWARE_TYPE,$_GET["ID"],1,$_GET["withtemplate"]); |
122 |
showContractAssociated(SOFTWARE_TYPE,$_GET["ID"],$_GET["withtemplate"]); |
123 |
break;
|
124 |
case 5 : |
125 |
showDocumentAssociated(SOFTWARE_TYPE,$_GET["ID"],$_GET["withtemplate"]); |
126 |
break;
|
127 |
default :
|
128 |
displayPluginAction(SOFTWARE_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'], $_GET["withtemplate"]); |
129 |
break;
|
130 |
} |
131 |
} |
132 |
|
133 |
} |
134 |
|
135 |
} else {
|
136 |
|
137 |
if ($soft->showForm($_SERVER['PHP_SELF'],$_GET["ID"],$_GET['withtemplate'])){ |
138 |
switch($_SESSION['glpi_onglet']){ |
139 |
case -1: |
140 |
showLicensesAdd($_GET["ID"]); |
141 |
showLicenses($_GET["ID"]); |
142 |
showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",SOFTWARE_TYPE,$_GET["ID"]); |
143 |
showContractAssociated(SOFTWARE_TYPE,$_GET["ID"]); |
144 |
showDocumentAssociated(SOFTWARE_TYPE,$_GET["ID"]); |
145 |
showJobListForItem($_SESSION["glpiname"],SOFTWARE_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
146 |
showOldJobListForItem($_SESSION["glpiname"],SOFTWARE_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
147 |
showLinkOnDevice(SOFTWARE_TYPE,$_GET["ID"]); |
148 |
displayPluginAction(SOFTWARE_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"]); |
149 |
break;
|
150 |
case 2 : |
151 |
showLicensesAdd($_GET["ID"]); |
152 |
showLicenses($_GET["ID"],1); |
153 |
break;
|
154 |
case 4 : |
155 |
showInfocomForm($CFG_GLPI["root_doc"]."/front/infocom.form.php",SOFTWARE_TYPE,$_GET["ID"]); |
156 |
showContractAssociated(SOFTWARE_TYPE,$_GET["ID"]); |
157 |
break;
|
158 |
case 5 : |
159 |
showDocumentAssociated(SOFTWARE_TYPE,$_GET["ID"]); |
160 |
break;
|
161 |
case 6 : |
162 |
showJobListForItem($_SESSION["glpiname"],SOFTWARE_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
163 |
showOldJobListForItem($_SESSION["glpiname"],SOFTWARE_TYPE,$_GET["ID"],$_GET["sort"],$_GET["order"]); |
164 |
break;
|
165 |
case 7 : |
166 |
showLinkOnDevice(SOFTWARE_TYPE,$_GET["ID"]); |
167 |
break;
|
168 |
case 10 : |
169 |
showNotesForm($_SERVER['PHP_SELF'],SOFTWARE_TYPE,$_GET["ID"]); |
170 |
break;
|
171 |
case 11 : |
172 |
showDeviceReservations($_SERVER['PHP_SELF'],SOFTWARE_TYPE,$_GET["ID"]); |
173 |
break;
|
174 |
case 12 : |
175 |
showHistory(SOFTWARE_TYPE,$_GET["ID"]); |
176 |
break;
|
177 |
default :
|
178 |
if (!displayPluginAction(SOFTWARE_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'],$_GET["withtemplate"])){ |
179 |
showLicensesAdd($_GET["ID"]); |
180 |
showLicenses($_GET["ID"]); |
181 |
} |
182 |
break;
|
183 |
} |
184 |
} |
185 |
} |
186 |
|
187 |
commonFooter(); |
188 |
} |
189 |
|
190 |
?>
|