ryxeo-glpi-git / htdocs / front / massiveaction.php @ 1c14bcc4
Historique | Voir | Annoter | Télécharger (17,5 ko)
1 | 1c14bcc4 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: massiveaction.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 | $NEEDED_ITEMS=array("user","tracking","reservation","document","computer","device","printer","networking", |
||
38 | "peripheral","monitor","software","infocom","phone","link","ocsng","consumable","cartridge", |
||
39 | "contract","enterprise","contact","group","profile","search","mailgate","typedoc","admininfo", |
||
40 | "registry","setup","rulesengine","rule.right", "rule.softwarecategories","rule.dictionnary.software","rule.dictionnary.dropdown","entity","ldap","transfer"); |
||
41 | |||
42 | define('GLPI_ROOT', '..'); |
||
43 | include (GLPI_ROOT . "/inc/includes.php"); |
||
44 | |||
45 | header("Content-Type: text/html; charset=UTF-8"); |
||
46 | header_nocache(); |
||
47 | |||
48 | if (isset($_GET['multiple_actions'])){ |
||
49 | if (isset($_SESSION['glpi_massiveaction'])&&isset($_SESSION['glpi_massiveaction']['POST'])){ |
||
50 | $_POST=$_SESSION['glpi_massiveaction']['POST']; |
||
51 | } |
||
52 | } |
||
53 | |||
54 | if (isset($_POST["device_type"])){ |
||
55 | |||
56 | |||
57 | switch ($_POST["device_type"]){ |
||
58 | case TRACKING_TYPE : |
||
59 | switch ($_POST["action"]){ |
||
60 | case "delete": |
||
61 | checkTypeRight("delete","1"); |
||
62 | break;
|
||
63 | case "add_followup": |
||
64 | checkTypeRight("comment_all_ticket","1"); |
||
65 | break;
|
||
66 | default:
|
||
67 | checkTypeRight("update_ticket","1"); |
||
68 | break;
|
||
69 | } |
||
70 | break;
|
||
71 | default :
|
||
72 | if (in_array($_POST["device_type"],$CFG_GLPI["infocom_types"])){ |
||
73 | checkSeveralRightsOr(array($_POST["device_type"]=>"w","contract_infocom"=>"w")); |
||
74 | } else {
|
||
75 | checkTypeRight($_POST["device_type"],"w"); |
||
76 | } |
||
77 | break;
|
||
78 | } |
||
79 | |||
80 | commonHeader($LANG["title"][42],$_SERVER['PHP_SELF']); |
||
81 | |||
82 | |||
83 | if (isset($_GET['multiple_actions'])){ |
||
84 | if (isset($_SESSION['glpi_massiveaction'])&&isset($_SESSION['glpi_massiveaction']['items'])){ |
||
85 | $percent=min(100,round(100*($_SESSION['glpi_massiveaction']['item_count']-count($_SESSION['glpi_massiveaction']['items']))/$_SESSION['glpi_massiveaction']['item_count'],0)); |
||
86 | displayProgressBar(400,$percent); |
||
87 | } |
||
88 | } |
||
89 | |||
90 | |||
91 | if (isset($_POST["action"])&&isset($_POST["device_type"])&&isset($_POST["item"])&&count($_POST["item"])){ |
||
92 | |||
93 | // Save selection
|
||
94 | if (!isset($_SESSION['glpimassiveactionselected'])||count($_SESSION['glpimassiveactionselected'])==0){ |
||
95 | $_SESSION['glpimassiveactionselected']=array(); |
||
96 | foreach ($_POST["item"] as $key => $val){ |
||
97 | if ($val==1) { |
||
98 | $_SESSION['glpimassiveactionselected'][$key]=$key; |
||
99 | } |
||
100 | } |
||
101 | } |
||
102 | |||
103 | if (isset($_SERVER['HTTP_REFERER'])){ |
||
104 | $REDIRECT=$_SERVER['HTTP_REFERER']; |
||
105 | } else { // Security : not used if no problem |
||
106 | $REDIRECT=$CFG_GLPI['root_doc']."/front/central.php"; |
||
107 | } |
||
108 | |||
109 | switch($_POST["action"]){ |
||
110 | case "connect_to_computer": |
||
111 | $ci=new CommonItem(); |
||
112 | $ci2=new CommonItem(); |
||
113 | |||
114 | if (isset($_POST["connect_item"])&&$_POST["connect_item"]){ |
||
115 | foreach ($_POST["item"] as $key => $val){ |
||
116 | if ($val==1&&$ci->getFromDB($_POST["type"],$_POST["connect_item"])) { |
||
117 | // Items exists ?
|
||
118 | if ($ci2->getFromDB(COMPUTER_TYPE,$key)){ |
||
119 | // Entity security
|
||
120 | if ($ci->obj->fields["FK_entities"]==$ci2->obj->fields["FK_entities"]){ |
||
121 | if ($ci->obj->fields["is_global"] |
||
122 | ||(!$ci->obj->fields["is_global"]&&getNumberConnections($_POST["device_type"],$key)==0)){ |
||
123 | Connect($_POST["connect_item"],$key,$_POST["type"]); |
||
124 | } |
||
125 | } |
||
126 | } |
||
127 | } |
||
128 | } |
||
129 | } |
||
130 | |||
131 | break;
|
||
132 | |||
133 | case "connect": |
||
134 | $ci=new CommonItem(); |
||
135 | $ci2=new CommonItem(); |
||
136 | |||
137 | if (isset($_POST["connect_item"])&&$_POST["connect_item"]){ |
||
138 | foreach ($_POST["item"] as $key => $val){ |
||
139 | if ($val==1&&$ci->getFromDB($_POST["device_type"],$key)) { |
||
140 | // Items exists ?
|
||
141 | if ($ci2->getFromDB(COMPUTER_TYPE,$_POST["connect_item"])){ |
||
142 | // Entity security
|
||
143 | if ($ci->obj->fields["FK_entities"]==$ci2->obj->fields["FK_entities"]){ |
||
144 | if ($ci->obj->fields["is_global"] |
||
145 | ||(!$ci->obj->fields["is_global"]&&getNumberConnections($_POST["device_type"],$key)==0)){ |
||
146 | Connect($key,$_POST["connect_item"],$_POST["device_type"]); |
||
147 | } |
||
148 | } |
||
149 | } |
||
150 | } |
||
151 | } |
||
152 | } |
||
153 | |||
154 | break;
|
||
155 | case "disconnect": |
||
156 | foreach ($_POST["item"] as $key => $val){ |
||
157 | if ($val==1) { |
||
158 | $query="SELECT * FROM glpi_connect_wire WHERE type='".$_POST["device_type"]."' AND end1 = '$key'"; |
||
159 | $result=$DB->query($query); |
||
160 | if ($DB->numrows($result)>0){ |
||
161 | while ($data=$DB->fetch_assoc($result)){ |
||
162 | Disconnect($data["ID"]); |
||
163 | } |
||
164 | } |
||
165 | } |
||
166 | } |
||
167 | break;
|
||
168 | case "delete": |
||
169 | $ci=new CommonItem(); |
||
170 | $ci->setType($_POST["device_type"],1); |
||
171 | foreach ($_POST["item"] as $key => $val){ |
||
172 | if ($val==1) { |
||
173 | $ci->obj->delete(array("ID"=>$key)); |
||
174 | } |
||
175 | } |
||
176 | break;
|
||
177 | case "purge": |
||
178 | $ci=new CommonItem(); |
||
179 | $ci->setType($_POST["device_type"],1); |
||
180 | foreach ($_POST["item"] as $key => $val){ |
||
181 | if ($val==1) { |
||
182 | $ci->obj->delete(array("ID"=>$key),1); |
||
183 | } |
||
184 | } |
||
185 | break;
|
||
186 | case "restore": |
||
187 | $ci=new CommonItem(); |
||
188 | $ci->setType($_POST["device_type"],1); |
||
189 | foreach ($_POST["item"] as $key => $val){ |
||
190 | if ($val==1) { |
||
191 | $ci->obj->restore(array("ID"=>$key)); |
||
192 | } |
||
193 | } |
||
194 | break;
|
||
195 | case "update": |
||
196 | $searchopt=cleanSearchOption($_POST["device_type"],'w'); |
||
197 | |||
198 | if (isset($searchopt[$_POST["id_field"]])){ |
||
199 | // Infocoms case
|
||
200 | if ($_POST["device_type"]<1000&&isInfocomSearch($_POST["device_type"],$_POST["id_field"])){ |
||
201 | $ic=new Infocom(); |
||
202 | $ci=new CommonItem(); |
||
203 | $ci->setType($_POST["device_type"],1); |
||
204 | |||
205 | $link_entity_type=-1; |
||
206 | // Specific entity item
|
||
207 | if ($searchopt[$_POST["id_field"]]["table"]=="glpi_enterprises_infocoms"){ |
||
208 | $ent=new Enterprise(); |
||
209 | if ($ent->getFromDB($_POST[$_POST["field"]])){ |
||
210 | $link_entity_type=$ent->fields["FK_entities"]; |
||
211 | } |
||
212 | |||
213 | } |
||
214 | |||
215 | foreach ($_POST["item"] as $key => $val){ |
||
216 | if ($val==1){ |
||
217 | if ($ci->getFromDB($_POST["device_type"],$key)){ |
||
218 | if ($link_entity_type<0 |
||
219 | ||$link_entity_type==$ci->obj->fields["FK_entities"] |
||
220 | ||($ent->fields["recursive"] && in_array($link_entity_type, getEntityAncestors($ci->obj->fields["FK_entities"])))){ |
||
221 | unset($ic->fields); |
||
222 | $ic->update(array("device_type"=>$_POST["device_type"],"FK_device"=>$key,$_POST["field"] => $_POST[$_POST["field"]])); |
||
223 | } |
||
224 | // else error_log("Access denied for update, infocom $link_entity_type!=" .$ci->obj->fields["FK_entities"]);
|
||
225 | } |
||
226 | } |
||
227 | } |
||
228 | } else { // Not infocoms |
||
229 | $ci=new CommonItem(); |
||
230 | $ci->setType($_POST["device_type"],1); |
||
231 | $link_entity_type=-1; |
||
232 | // Specific entity item
|
||
233 | |||
234 | if ($searchopt[$_POST["id_field"]]["table"]!=$LINK_ID_TABLE[$_POST["device_type"]] |
||
235 | && in_array($searchopt[$_POST["id_field"]]["table"],$CFG_GLPI["specif_entities_tables"]) |
||
236 | && in_array($LINK_ID_TABLE[$_POST["device_type"]],$CFG_GLPI["specif_entities_tables"])){ |
||
237 | |||
238 | $ci2=new CommonDBTM(); |
||
239 | $ci2->table=$searchopt[$_POST["id_field"]]["table"]; |
||
240 | |||
241 | if ($ci2->getFromDB($_POST[$_POST["field"]])){ |
||
242 | if (isset($ci2->fields["FK_entities"])&&$ci2->fields["FK_entities"]>=0){ |
||
243 | $link_entity_type=$ci2->fields["FK_entities"]; |
||
244 | } |
||
245 | |||
246 | } |
||
247 | |||
248 | } |
||
249 | foreach ($_POST["item"] as $key => $val){ |
||
250 | if ($val==1) { |
||
251 | if ($ci->getFromDB($_POST["device_type"],$key)){ |
||
252 | if ($link_entity_type<0 |
||
253 | ||$link_entity_type==$ci->obj->fields["FK_entities"]){ |
||
254 | $ci->obj->update(array("ID"=>$key,$_POST["field"] => $_POST[$_POST["field"]])); |
||
255 | } |
||
256 | // else error_log("Access denied for update (not infocom)");
|
||
257 | } |
||
258 | } |
||
259 | } |
||
260 | } |
||
261 | } |
||
262 | break;
|
||
263 | case "install": |
||
264 | foreach ($_POST["item"] as $key => $val){ |
||
265 | if ($val==1) { |
||
266 | $comp=new Computer; |
||
267 | if ($comp->getFromDB($key)&&$comp->fields["FK_entities"]==$_SESSION["glpiactive_entity"]){ |
||
268 | installSoftware($key,$_POST["lID"],$_POST["sID"]); |
||
269 | } |
||
270 | } |
||
271 | } |
||
272 | break;
|
||
273 | case "add_group": |
||
274 | foreach ($_POST["item"] as $key => $val){ |
||
275 | if ($val==1) { |
||
276 | addUserGroup($key,$_POST["group"]); |
||
277 | } |
||
278 | } |
||
279 | break;
|
||
280 | case "add_userprofile": |
||
281 | $input['FK_entities']=$_POST['FK_entities']; |
||
282 | $input['FK_profiles']=$_POST['FK_profiles']; |
||
283 | $input['recursive']=$_POST['recursive']; |
||
284 | foreach ($_POST["item"] as $key => $val){ |
||
285 | if ($val==1) { |
||
286 | $input['FK_users']=$key; |
||
287 | addUserProfileEntity($input);
|
||
288 | } |
||
289 | } |
||
290 | break;
|
||
291 | case "add_document": |
||
292 | $ci=new CommonItem(); |
||
293 | $ci2=new CommonItem(); |
||
294 | if ($ci->getFromDB(DOCUMENT_TYPE,$_POST['docID'])){ |
||
295 | foreach ($_POST["item"] as $key => $val){ |
||
296 | if ($val==1) { |
||
297 | // Items exists ?
|
||
298 | if ($ci2->getFromDB($_POST["device_type"],$key)){ |
||
299 | // Entity security
|
||
300 | if (!isset($ci2->obj->fields["FK_entities"]) |
||
301 | ||$ci->obj->fields["FK_entities"]==$ci2->obj->fields["FK_entities"] |
||
302 | ||($ci->obj->fields["recursive"] && in_array($ci->obj->fields["FK_entities"], getEntityAncestors($ci2->obj->fields["FK_entities"])))){ |
||
303 | addDeviceDocument($_POST['docID'],$_POST["device_type"],$key); |
||
304 | } |
||
305 | } |
||
306 | } |
||
307 | } |
||
308 | } |
||
309 | break;
|
||
310 | case "add_contact": |
||
311 | $ci=new CommonItem(); |
||
312 | $ci2=new CommonItem(); |
||
313 | if ($ci->getFromDB(CONTACT_TYPE,$_POST['conID'])){ |
||
314 | foreach ($_POST["item"] as $key => $val){ |
||
315 | if ($val==1) { |
||
316 | // Items exists ?
|
||
317 | if ($ci2->getFromDB($_POST["device_type"],$key)){ |
||
318 | // Entity security
|
||
319 | if (!isset($ci2->obj->fields["FK_entities"]) |
||
320 | ||$ci->obj->fields["FK_entities"]==$ci2->obj->fields["FK_entities"] |
||
321 | ||($ci->obj->fields["recursive"] && in_array($ci->obj->fields["FK_entities"], getEntityAncestors($ci2->obj->fields["FK_entities"])))){ |
||
322 | addContactEnterprise($key,$_POST["conID"]); |
||
323 | } |
||
324 | } |
||
325 | } |
||
326 | } |
||
327 | } |
||
328 | break;
|
||
329 | case "add_contract": |
||
330 | $ci=new CommonItem(); |
||
331 | $ci2=new CommonItem(); |
||
332 | if ($ci->getFromDB(CONTRACT_TYPE,$_POST['conID'])){ |
||
333 | foreach ($_POST["item"] as $key => $val){ |
||
334 | if ($val==1) { |
||
335 | // Items exists ?
|
||
336 | if ($ci2->getFromDB($_POST["device_type"],$key)){ |
||
337 | // Entity security
|
||
338 | if (!isset($ci2->obj->fields["FK_entities"]) |
||
339 | ||$ci->obj->fields["FK_entities"]==$ci->obj->fields["FK_entities"] |
||
340 | ||($ci->obj->fields["recursive"] && in_array($ci->obj->fields["FK_entities"], getEntityAncestors($ci2->obj->fields["FK_entities"])))){ |
||
341 | addDeviceContract($_POST['conID'],$_POST["device_type"],$key); |
||
342 | } |
||
343 | } |
||
344 | } |
||
345 | } |
||
346 | } |
||
347 | |||
348 | break;
|
||
349 | case "add_enterprise": |
||
350 | $ci=new CommonItem(); |
||
351 | $ci2=new CommonItem(); |
||
352 | if ($ci->getFromDB(ENTERPRISE_TYPE,$_POST['entID'])){ |
||
353 | foreach ($_POST["item"] as $key => $val){ |
||
354 | if ($val==1) { |
||
355 | // Items exists ?
|
||
356 | if ($ci2->getFromDB($_POST["device_type"],$key)){ |
||
357 | // Entity security
|
||
358 | if (!isset($ci2->obj->fields["FK_entities"]) |
||
359 | ||$ci->obj->fields["FK_entities"]==$ci2->obj->fields["FK_entities"] |
||
360 | ||($ci->obj->fields["recursive"] && in_array($ci->obj->fields["FK_entities"], getEntityAncestors($ci2->obj->fields["FK_entities"])))){ |
||
361 | addContactEnterprise($_POST["entID"],$key); |
||
362 | } |
||
363 | } |
||
364 | } |
||
365 | } |
||
366 | } |
||
367 | break;
|
||
368 | case "unlock_ocsng_field": |
||
369 | $fields=getOcsLockableFields();
|
||
370 | if ($_POST['field']=='all'||isset($fields[$_POST['field']])){ |
||
371 | foreach ($_POST["item"] as $key => $val){ |
||
372 | if ($val==1) { |
||
373 | if ($_POST['field']=='all'){ |
||
374 | replaceOcsArray($key,array(),"computer_update"); |
||
375 | } else {
|
||
376 | deleteInOcsArray($key,$_POST['field'],"computer_update",true); |
||
377 | } |
||
378 | } |
||
379 | } |
||
380 | } |
||
381 | break;
|
||
382 | case "unlock_ocsng_monitor": |
||
383 | case "unlock_ocsng_printer": |
||
384 | case "unlock_ocsng_peripheral": |
||
385 | case "unlock_ocsng_software": |
||
386 | case "unlock_ocsng_ip": |
||
387 | foreach ($_POST["item"] as $key => $val){ |
||
388 | if ($val==1) { |
||
389 | switch ($_POST["action"]){ |
||
390 | case "unlock_ocsng_monitor": |
||
391 | ocsUnlockItems($key,"import_monitor"); |
||
392 | break;
|
||
393 | case "unlock_ocsng_printer": |
||
394 | ocsUnlockItems($key,"import_printers"); |
||
395 | break;
|
||
396 | case "unlock_ocsng_peripheral": |
||
397 | ocsUnlockItems($key,"import_peripheral"); |
||
398 | break;
|
||
399 | case "unlock_ocsng_software": |
||
400 | ocsUnlockItems($key,"import_software"); |
||
401 | break;
|
||
402 | case "unlock_ocsng_ip": |
||
403 | ocsUnlockItems($key,"import_ip"); |
||
404 | break;
|
||
405 | } |
||
406 | } |
||
407 | } |
||
408 | break;
|
||
409 | |||
410 | case "force_ocsng_update": |
||
411 | // First time
|
||
412 | if (!isset($_GET['multiple_actions'])){ |
||
413 | $_SESSION['glpi_massiveaction']['POST']=$_POST; |
||
414 | $_SESSION['glpi_massiveaction']['REDIRECT']=$REDIRECT; |
||
415 | $_SESSION['glpi_massiveaction']['items']=array(); |
||
416 | foreach ($_POST["item"] as $key => $val){ |
||
417 | if ($val==1) { |
||
418 | $_SESSION['glpi_massiveaction']['items'][$key]=$key; |
||
419 | } |
||
420 | } |
||
421 | $_SESSION['glpi_massiveaction']['item_count']=count($_SESSION['glpi_massiveaction']['items']); |
||
422 | glpi_header($_SERVER['PHP_SELF'].'?multiple_actions=1'); |
||
423 | } else {
|
||
424 | if (count($_SESSION['glpi_massiveaction']['items'])>0){ |
||
425 | $key=array_pop($_SESSION['glpi_massiveaction']['items']); |
||
426 | //Try to get the OCS server whose machine belongs
|
||
427 | $query = "SELECT ocs_server_id, ID |
||
428 | FROM glpi_ocs_link
|
||
429 | WHERE glpi_id='".$key."'"; |
||
430 | $result = $DB->query($query); |
||
431 | if ($DB->numrows($result) == 1) { |
||
432 | $data = $DB->fetch_assoc($result); |
||
433 | if ($data['ocs_server_id'] != -1){ |
||
434 | //Force update of the machine
|
||
435 | ocsUpdateComputer($data['ID'],$data['ocs_server_id'],1,1); |
||
436 | } |
||
437 | } |
||
438 | glpi_header($_SERVER['PHP_SELF'].'?multiple_actions=1'); |
||
439 | } else {
|
||
440 | $REDIRECT=$_SESSION['glpi_massiveaction']['REDIRECT']; |
||
441 | unset($_SESSION['glpi_massiveaction']); |
||
442 | glpi_header($REDIRECT);
|
||
443 | } |
||
444 | } |
||
445 | break;
|
||
446 | |||
447 | case "compute_software_category": |
||
448 | $softcatrule = new SoftwareCategoriesRuleCollection; |
||
449 | $soft = new Software; |
||
450 | foreach ($_POST["item"] as $key => $val){ |
||
451 | if ($val==1) { |
||
452 | $params = array(); |
||
453 | //Get software name and manufacturer
|
||
454 | $soft->getFromDB($key); |
||
455 | $params["name"]=$soft->fields["name"]; |
||
456 | $params["FK_glpi_enterprise"]=$soft->fields["FK_glpi_enterprise"]; |
||
457 | |||
458 | //Process rules
|
||
459 | $soft->update($softcatrule->processAllRules(null,$soft->fields,$params)); |
||
460 | } |
||
461 | } |
||
462 | break;
|
||
463 | |||
464 | case "replay_dictionnary": |
||
465 | $softdictionnayrule = new DictionnarySoftwareCollection; |
||
466 | $ids=array(); |
||
467 | foreach ($_POST["item"] as $key => $val){ |
||
468 | if ($val==1) |
||
469 | $ids[]=$key; |
||
470 | } |
||
471 | $softdictionnayrule->replayRulesOnExistingDB(0,0,$ids); |
||
472 | break;
|
||
473 | |||
474 | case "force_user_ldap_update": |
||
475 | checkRight("user","w"); |
||
476 | |||
477 | $user = new User; |
||
478 | $ids=array(); |
||
479 | foreach ($_POST["item"] as $key => $val){ |
||
480 | if ($val==1) |
||
481 | { |
||
482 | $user->getFromDB($key); |
||
483 | if (($user->fields["auth_method"] == AUTH_LDAP) || ($user->fields["auth_method"] == AUTH_EXTERNAL)) |
||
484 | ldapImportUserByServerId($user->fields["name"],1,$user->fields["id_auth"]); |
||
485 | } |
||
486 | } |
||
487 | break;
|
||
488 | |||
489 | case "add_transfer_list": |
||
490 | if (!isset($_SESSION['glpitransfer_list'])){ |
||
491 | $_SESSION['glpitransfer_list']=array(); |
||
492 | } |
||
493 | if (!isset($_SESSION['glpitransfer_list'][$_POST["device_type"]])){ |
||
494 | $_SESSION['glpitransfer_list'][$_POST["device_type"]]=array(); |
||
495 | } |
||
496 | |||
497 | foreach ($_POST["item"] as $key => $val){ |
||
498 | if ($val==1) { |
||
499 | $_SESSION['glpitransfer_list'][$_POST["device_type"]][$key]=$key; |
||
500 | } |
||
501 | } |
||
502 | $REDIRECT=$CFG_GLPI['root_doc'].'/front/transfer.action.php'; |
||
503 | break;
|
||
504 | case "add_followup": |
||
505 | $fup=new Followup(); |
||
506 | foreach ($_POST["item"] as $key => $val){ |
||
507 | if ($val==1) { |
||
508 | $_POST['tracking']=$key; |
||
509 | unset($fup->fields); |
||
510 | $fup->add($_POST); |
||
511 | } |
||
512 | } |
||
513 | break;
|
||
514 | default :
|
||
515 | // Plugin specific actions
|
||
516 | if ($_POST["device_type"]>1000){ |
||
517 | if (isset($PLUGIN_HOOKS['plugin_types'][$_POST["device_type"]])){ |
||
518 | $function='plugin_'.$PLUGIN_HOOKS['plugin_types'][$_POST["device_type"]].'_MassiveActionsProcess'; |
||
519 | if (function_exists($function)){ |
||
520 | $function($_POST); |
||
521 | } |
||
522 | } |
||
523 | } else {
|
||
524 | // Need to search display item over plugins
|
||
525 | $split=split('_',$_POST["action"]); |
||
526 | if (isset($split[1])){ |
||
527 | $function='plugin_'.$split[1].'_MassiveActionsProcess'; |
||
528 | if (function_exists($function)){ |
||
529 | $function($_POST); |
||
530 | } |
||
531 | } |
||
532 | } |
||
533 | |||
534 | break;
|
||
535 | } |
||
536 | |||
537 | addMessageAfterRedirect($LANG["common"][23]); |
||
538 | glpi_header($REDIRECT);
|
||
539 | |||
540 | } else {
|
||
541 | |||
542 | echo "<div align='center'><img src=\"".$CFG_GLPI["root_doc"]."/pics/warning.png\" alt=\"warning\"><br><br>"; |
||
543 | echo "<b>".$LANG["common"][24]."</b></div>"; |
||
544 | |||
545 | displayBackLink(); |
||
546 | } |
||
547 | |||
548 | commonFooter(); |
||
549 | } |
||
550 | |||
551 | ?> |