ryxeo-glpi-git / plugins / manageentity / index.php @ 57ea0d38
Historique | Voir | Annoter | Télécharger (8,92 ko)
1 | b67d8923 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | ----------------------------------------------------------------------
|
||
4 | GLPI - Gestionnaire Libre de Parc Informatique
|
||
5 | Copyright (C) 2003-2008 by the INDEPNET Development Team.
|
||
6 | |||
7 | http://indepnet.net/ http://glpi-project.org/
|
||
8 | ----------------------------------------------------------------------
|
||
9 | |||
10 | LICENSE
|
||
11 | |||
12 | entdata file is part of GLPI.
|
||
13 | |||
14 | GLPI is free software; you can redistribute it and/or modify
|
||
15 | it under the terms of the GNU General Public License as published by
|
||
16 | the Free Software Foundation; either version 2 of the License, or
|
||
17 | (at your option) any later version.
|
||
18 | |||
19 | GLPI is distributed in the hope that it will be useful,
|
||
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
22 | GNU General Public License for more details.
|
||
23 | |||
24 | You should have received a copy of the GNU General Public License
|
||
25 | along with GLPI; if not, write to the Free Software
|
||
26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
27 | ------------------------------------------------------------------------
|
||
28 | */
|
||
29 | |||
30 | // ----------------------------------------------------------------------
|
||
31 | // Original Author of file: GRISARD Jean Marc & CAILLAUD Xavier
|
||
32 | // Purpose of file:
|
||
33 | // ----------------------------------------------------------------------
|
||
34 | $NEEDED_ITEMS=array("computer","printer","networking","monitor","software","peripheral","phone","tracking","document","user","enterprise","contract","infocom","group","entity"); |
||
35 | define('GLPI_ROOT', '../..'); |
||
36 | include (GLPI_ROOT."/inc/includes.php"); |
||
37 | if(isset($_GET)) $tab = $_GET; |
||
38 | if(empty($tab) && isset($_POST)) $tab = $_POST; |
||
39 | if(!isset($tab["ID"])) $tab["ID"] = ""; |
||
40 | if(!isset($_POST["FK_entities"])) $_POST["FK_entities"] = ""; |
||
41 | |||
42 | commonHeader($LANGMANAGEENTITY["title"][1],$_SERVER["PHP_SELF"],"plugins","manageentity"); |
||
43 | |||
44 | if(plugin_manageentity_haveRight("manageentity","r") || haveRight("config","w")){ |
||
45 | |||
46 | if(!isset($_SESSION["glpi_plugin_manageentity_installed"]) || $_SESSION["glpi_plugin_manageentity_installed"]!=1) { |
||
47 | |||
48 | glpi_header("./front/plugin_manageentity.config.php");
|
||
49 | |||
50 | } elseif (isset($_POST["addcontracts"])){ |
||
51 | |||
52 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
53 | plugin_manageentity_addcontracts($_POST["entID"],$_POST["conID"]); |
||
54 | glpi_header($_SERVER['HTTP_REFERER']); |
||
55 | 57ea0d38 | Eric Seigne | } elseif (isset($_POST["anetinsertnextupgrade"])){ |
56 | //ryxeo
|
||
57 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
58 | plugin_manageentity_anetinsertnextupgrade($_POST["srvID"],$_POST["upgradecmd"]); |
||
59 | glpi_header($_SERVER['HTTP_REFERER']); |
||
60 | }else if (isset($_GET["deletecontracts"])){ |
||
61 | b67d8923 | Eric Seigne | |
62 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
63 | plugin_manageentity_deletecontracts($_GET["ID"]); |
||
64 | glpi_header($_SERVER['HTTP_REFERER']); |
||
65 | |||
66 | }else if (isset($_POST["adddocuments"])){ |
||
67 | |||
68 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
69 | plugin_manageentity_adddocuments($_POST["entID"],$_POST["conID"]); |
||
70 | glpi_header($_SERVER['HTTP_REFERER']); |
||
71 | } |
||
72 | else if (isset($_GET["deletedocuments"])){ |
||
73 | |||
74 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
75 | plugin_manageentity_deletedocuments($_GET["ID"]); |
||
76 | glpi_header($_SERVER['HTTP_REFERER']); |
||
77 | |||
78 | }else if (isset($_POST["addcontacts"])){ |
||
79 | |||
80 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
81 | plugin_manageentity_addcontacts($_POST["cID"],$_POST["eID"]); |
||
82 | glpi_header($_SERVER['HTTP_REFERER']); |
||
83 | } |
||
84 | else if (isset($_GET["deletecontacts"])){ |
||
85 | |||
86 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
87 | plugin_manageentity_deletecontacts($_GET["ID"]); |
||
88 | glpi_header($_SERVER['HTTP_REFERER']); |
||
89 | |||
90 | }else if (isset($_POST["addticket"])){ |
||
91 | |||
92 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
93 | plugin_manageentity_addticket($_POST["conID"],$_POST['item']); |
||
94 | glpi_header($_SERVER['HTTP_REFERER']); |
||
95 | } |
||
96 | else if (isset($_GET["deleteticket"])){ |
||
97 | |||
98 | if(plugin_manageentity_HaveRight("manageentity","w")) |
||
99 | plugin_manageentity_deleteticket($_GET["ID"]); |
||
100 | glpi_header($_SERVER['HTTP_REFERER']); |
||
101 | |||
102 | }else// Manage entity change |
||
103 | if (isset($_GET["active_entity"])){ |
||
104 | if (!isset($_GET["recursive"])) { |
||
105 | $_GET["recursive"]=0; |
||
106 | } |
||
107 | changeActiveEntities($_GET["active_entity"],$_GET["recursive"]); |
||
108 | if ($_GET["active_entity"]==$_SESSION["glpiactive_entity"]){ |
||
109 | glpi_header(preg_replace("/FK_entities.*/","",$CFG_GLPI["root_doc"]."/plugins/manageentity/index.php")); |
||
110 | } |
||
111 | }elseif (isset($_POST["choice_entity"]) && $_POST["FK_entities"]!=0){ |
||
112 | |||
113 | glpi_header($CFG_GLPI["root_doc"]."/plugins/manageentity/index.php?active_entity=".$_POST["FK_entities"].""); |
||
114 | |||
115 | }elseif ($_SESSION["glpiactive_entity"]!=0) { |
||
116 | |||
117 | echo "<div align='center'><table class='tab_cadre_central'>"; |
||
118 | echo "<tr>"; |
||
119 | echo "<td align='center'><br><span class='plugin_manageentity_color'>".$LANGMANAGEENTITY["manageentity"][1]." ".$_SESSION["glpiactive_entity_name"]."</span></td>"; |
||
120 | echo "</tr>"; |
||
121 | echo "<tr>"; |
||
122 | echo "<td valign='top'>"; |
||
123 | $entdata=new EntityData(); |
||
124 | $entdata->getFromDB($_SESSION["glpiactive_entity"]); |
||
125 | $entity=new Entity(); |
||
126 | $entity->getFromDB($_SESSION["glpiactive_entity"]); |
||
127 | echo "<br>"; |
||
128 | echo "<table class='tab_cadre' align='center' width='90%'>"; |
||
129 | |||
130 | //ryxeo
|
||
131 | $entityid=$_SESSION["glpiactive_entity"]; |
||
132 | echo "<tr><th colspan='8'>Coordonnées du client -- <a href=\"../../front/entity.form.php?ID=$entityid\">[mettre à jour]</a></th></tr>"; |
||
133 | |||
134 | echo "<tr class='tab_bg_1'>"; |
||
135 | echo "<td valign='top'>".$LANG["common"][16].": </td>"; |
||
136 | echo "<td valign='top'>"; |
||
137 | if ($_SESSION["glpiactive_entity"]!=0) |
||
138 | echo $entity->fields["name"]; |
||
139 | else
|
||
140 | echo $LANG["entity"][2]; |
||
141 | if ($_SESSION["glpiactive_entity"]!=0) echo " (".$entity->fields["completename"].")"; |
||
142 | echo "</td>"; |
||
143 | if (isset($entity->fields["comments"])){ |
||
144 | echo "<td valign='top'>"; |
||
145 | echo $LANG["common"][25].": </td>"; |
||
146 | echo "<td align='center' valign='top'>".nl2br($entity->fields["comments"]); |
||
147 | echo "</td>"; |
||
148 | } else {
|
||
149 | echo "<td colspan='2'> </td>"; |
||
150 | } |
||
151 | echo "</tr>"; |
||
152 | |||
153 | echo "<tr class='tab_bg_1'><td>".$LANG["help"][35].": </td>"; |
||
154 | echo "<td>"; |
||
155 | if (isset($entdata->fields["phonenumber"])) |
||
156 | echo $entdata->fields["phonenumber"]; |
||
157 | echo "</td>"; |
||
158 | echo "<td>".$LANG["financial"][30].": </td><td>"; |
||
159 | if (isset($entdata->fields["fax"])) |
||
160 | echo $entdata->fields["fax"]; |
||
161 | echo "</td></tr>"; |
||
162 | |||
163 | echo "<tr class='tab_bg_1'><td>".$LANG["financial"][45].": </td>"; |
||
164 | echo "<td>"; |
||
165 | if (isset($entdata->fields["website"])) |
||
166 | echo $entdata->fields["website"]; |
||
167 | echo "</td>"; |
||
168 | |||
169 | echo "<td>".$LANG["setup"][14].": </td><td>"; |
||
170 | if (isset($entdata->fields["email"])) |
||
171 | echo $entdata->fields["email"]; |
||
172 | echo "</td></tr>"; |
||
173 | |||
174 | echo "<tr class='tab_bg_1'><td rowspan='4'>".$LANG["financial"][44].": </td>"; |
||
175 | echo "<td align='left' valign='top' rowspan='4'>"; |
||
176 | if (isset($entdata->fields["address"])) |
||
177 | echo nl2br($entdata->fields["address"]); |
||
178 | echo "<td>".$LANG["financial"][100]."</td>"; |
||
179 | echo "<td>"; |
||
180 | if (isset($entdata->fields["postcode"])) |
||
181 | echo $entdata->fields["postcode"]; |
||
182 | echo "</td>"; |
||
183 | echo "</tr>"; |
||
184 | |||
185 | echo "<tr class='tab_bg_1'>"; |
||
186 | echo "<td>".$LANG["financial"][101].": </td><td>"; |
||
187 | if (isset($entdata->fields["town"])) |
||
188 | echo $entdata->fields["town"]; |
||
189 | echo "</td></tr>"; |
||
190 | |||
191 | echo "<tr class='tab_bg_1'>"; |
||
192 | echo "<td>".$LANG["financial"][102].": </td><td>"; |
||
193 | if (isset($entdata->fields["state"])) |
||
194 | echo $entdata->fields["state"]; |
||
195 | echo "</td></tr>"; |
||
196 | |||
197 | echo "<tr class='tab_bg_1'>"; |
||
198 | echo "<td>".$LANG["financial"][103].": </td><td>"; |
||
199 | if (isset($entdata->fields["country"])) |
||
200 | echo $entdata->fields["country"]; |
||
201 | echo "</td></tr>"; |
||
202 | |||
203 | echo "</table>"; |
||
204 | echo "</td></tr>"; |
||
205 | echo "<tr>"; |
||
206 | echo "<td valign='top'>"; |
||
207 | echo "<br>"; |
||
208 | plugin_manageentity_showanetepack($_SESSION["glpiactive_entity"]); |
||
209 | plugin_manageentity_showinventory($_SESSION["glpiactive_entity"]); |
||
210 | plugin_manageentity_showcontractsassociated($_SESSION["glpiactive_entity"]); |
||
211 | plugin_manageentity_showtickets($_SESSION["glpiactive_entity"]); |
||
212 | if(isset($_SESSION["glpi_plugin_ticketreport_installed"]) && $_SESSION["glpi_plugin_ticketreport_installed"]==1) |
||
213 | plugin_manageentity_showreports($_SESSION["glpiactive_entity"]); |
||
214 | else echo "<br>"; |
||
215 | plugin_manageentity_showdocuments($_SESSION["glpiactive_entity"]); |
||
216 | plugin_manageentity_showcontacts($_SESSION["glpiactive_entity"]); |
||
217 | 57ea0d38 | Eric Seigne | plugin_manageentity_showanetnextupgrade($_SESSION["glpiactive_entity"]); |
218 | b67d8923 | Eric Seigne | echo "</td></tr>"; |
219 | echo "</table></div>"; |
||
220 | |||
221 | }else{
|
||
222 | echo "<form action=\"index.php\" method=\"post\">"; |
||
223 | echo "<div align='center'><table class='tab_cadre'>"; |
||
224 | echo "<tr><th colspan='2'>".$LANGMANAGEENTITY["manageentity"][2]."</th></tr>"; |
||
225 | echo "<tr class='tab_bg_2'><td align='center'>"; |
||
226 | dropdownValue("glpi_entities", "FK_entities",$_POST["FK_entities"]); |
||
227 | echo "</td></tr>"; |
||
228 | echo "<tr class='tab_bg_2'><td align='center' colspan=2><input type=\"submit\" name=\"choice_entity\" class=\"submit\" value=\"" . $LANG["buttons"][2] . "\" ></td></tr>"; |
||
229 | echo "</table></div>"; |
||
230 | echo "</form>"; |
||
231 | |||
232 | } |
||
233 | }else{
|
||
234 | echo "<div align='center'><br><br><img src=\"".$CFG_GLPI["root_doc"]."/pics/warning.png\" alt=\"warning\"><br><br>"; |
||
235 | echo "<b>".$LANG["login"][5]."</b></div>"; |
||
236 | } |
||
237 | |||
238 | commonFooter(); |
||
239 | |||
240 | ?> |