File: find_num.php

package info (click to toggle)
glpi 0.68.2-1etch0.1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 7,464 kB
  • ctags: 9,655
  • sloc: php: 69,502; sql: 3,514; sh: 175; makefile: 61
file content (239 lines) | stat: -rw-r--r-- 9,950 bytes parent folder | download | duplicates (2)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?php
/*
 * @version $Id: find_num.php 3798 2006-08-22 15:12:55Z moyo $
 -------------------------------------------------------------------------
 GLPI - Gestionnaire Libre de Parc Informatique
 Copyright (C) 2003-2006 by the INDEPNET Development Team.

 http://indepnet.net/   http://glpi-project.org
 -------------------------------------------------------------------------

 LICENSE

 This file is part of GLPI.

 GLPI is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 GLPI 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 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with GLPI; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 --------------------------------------------------------------------------
 */

// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------

include ("_relpos.php");
$NEEDED_ITEMS=array("user");
include ($phproot . "/inc/includes.php");


if(isset($_GET["name"]) && ($_GET["name"] == "Helpdesk") && ($cfg_glpi["permit_helpdesk"] == "1"))
{
	$id = new Identification();
	$id->initSession();
} else exit();

// Send UTF8 Headers
header("Content-Type: text/html; charset=UTF-8");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>GLPI</title>

<?php
include ("_relpos.php");
// Appel CSS
echo "<link rel='stylesheet'  href='".$HTMLRel."css/styles.css' type='text/css' media='screen' >";
// Appel javascript
echo "<script type=\"text/javascript\" src='".$HTMLRel."script.js'></script>";

?>

</head>

<body>
<script language="javascript" type="text/javascript">
function fillidfield(Type,Id){
	window.opener.document.forms["helpdeskform"].elements["computer"].value = Id;
	window.opener.document.forms["helpdeskform"].elements["device_type"].value = Type;
	window.close();}
	</script>

	<?php 

	echo "<div align='center'>";
	echo "<p><strong>".$lang["help"][22]."</strong></p>";
	echo " <form name=\"form1\" method=\"post\"  action=\"".$_SERVER["PHP_SELF"]."\">"; 

	echo "<table cellspacing='1' width='100%'  class='tab_cadre'>";
	echo "<tr><th align='center'  width='100%' height='29'>".$lang["help"][23]."</th>";
	echo "</tr><tr><td class='tab_bg_1' align='center' width='100%'>"; 
	echo "<input name='NomContact' type='text' id='NomContact' >";
	echo "<input type='hidden' name='send' value='1' />"; // bug IE ! La validation par enter ne fonctionne pas sans cette ligne  incroyable mais vrai !
	echo "<input type='submit' name='send' value=\"". $lang["buttons"][0]."\">";
	echo "</td>  </tr> </table> </form></div>";


	if(isset($_POST["send"]))
{
	echo "<table width='100%' class='tab_cadre'>";
	echo " <tr class='tab_bg3'>";
	echo " <td align='center' width='30%'><b>".$lang["reports"][19]."</b></td>";
	echo " <td align='center' width='20%'><b>".$lang["help"][24]."</b></td>";
	echo " <td align='center' width='30%'><b>".$lang["common"][1]."</b></td>";
	echo " <td align='center' width='5%'><b>".$lang["common"][2]."</b></td>";
	echo " <td align='center' width='20%'><b>".$lang["common"][19]."&nbsp;/&nbsp;".$lang["common"][20]."</b></td>";
	echo " </tr>";


	$query = "select name,ID,contact, serial, otherserial from glpi_computers where is_template='0' AND deleted='N' AND (contact like '%".$_POST["NomContact"]."%' OR name like '%".$_POST["NomContact"]."%' OR serial like '%".$_POST["NomContact"]."%' OR otherserial like '%".$_POST["NomContact"]."%')";
	$result = $db->query($query);
	while($ligne = $db->fetch_array($result))
	{
		$Comp_num = $ligne['ID'];
		$Contact = $ligne['contact'];
		$Computer = $ligne['name'];
		$s1 = $ligne['serial'];
		$s2 = $ligne['otherserial'];
		echo " <tr class='tab_find' onClick=\"fillidfield(".COMPUTER_TYPE.",".$Comp_num.")\">";
		echo "<td width='25%' align='center'><b>&nbsp;$Contact</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;".$lang["help"][25]."</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;$Computer&nbsp;</b></td>";
		echo "<td  width='25%' align='center'>";
		echo "<b>&nbsp;$Comp_num </b></td>";
		echo "<td width='25%' align='center'>";
		if ($s1!="") echo $s1;
		if ($s1!=""&&$s2!="") echo "&nbsp;/&nbsp;";
		if ($s2!="") echo $s2;
		echo "</td>";
		echo "</tr>";
	}

	$query = "select name,ID,contact, serial, otherserial from glpi_networking where is_template='0' AND deleted='N' AND (contact like '%".$_POST["NomContact"]."%' OR name like '%".$_POST["NomContact"]."%' OR serial like '%".$_POST["NomContact"]."%' OR otherserial like '%".$_POST["NomContact"]."%')";
	$result = $db->query($query);
	while($ligne = $db->fetch_array($result))
	{
		$Comp_num = $ligne['ID'];
		$Contact = $ligne['contact'];
		$Computer = $ligne['name'];
		$s1 = $ligne['serial'];
		$s2 = $ligne['otherserial'];
		echo " <tr class='tab_find' onClick=\"fillidfield(".NETWORKING_TYPE.",".$Comp_num.")\">";
		echo "<td width='25%' align='center'><b>&nbsp;$Contact </b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;".$lang["help"][26]."</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;$Computer </b></td>";
		echo "<td  width='25%' align='center'>";
		echo "<b>&nbsp;$Comp_num </b></td>";
		echo "<td width='25%' align='center'>";
		if ($s1!="") echo $s1;
		if ($s1!=""&&$s2!="") echo "&nbsp;/&nbsp;";
		if ($s2!="") echo $s2;
		echo "</td>";
		echo "</tr>";
	}

	$query = "select name,ID,contact, serial, otherserial from glpi_printers where is_template='0' AND deleted='N' AND (contact like '%".$_POST["NomContact"]."%' OR name like '%".$_POST["NomContact"]."%' OR serial like '%".$_POST["NomContact"]."%' OR otherserial like '%".$_POST["NomContact"]."%')";
	$result = $db->query($query);
	while($ligne = $db->fetch_array($result))
	{
		$Comp_num = $ligne['ID'];
		$Contact = $ligne['contact'];
		$Computer = $ligne['name'];
		$s1 = $ligne['serial'];
		$s2 = $ligne['otherserial'];
		echo " <tr class='tab_find' onClick=\"fillidfield(".PRINTER_TYPE.",".$Comp_num.")\">";
		echo "<td width='25%' align='center'><b>&nbsp;$Contact </b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;".$lang["help"][27]."</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;$Computer </b></td>";
		echo "<td  width='25%' align='center'>";
		echo "<b>&nbsp;$Comp_num </b></td>";
		echo "<td width='25%' align='center'>";
		if ($s1!="") echo $s1;
		if ($s1!=""&&$s2!="") echo "&nbsp;/&nbsp;";
		if ($s2!="") echo $s2;
		echo "</td>";
		echo "</tr>";
	}

	$query = "select name,ID,contact, serial, otherserial from glpi_monitors where is_template='0' AND deleted='N' AND (contact like '%".$_POST["NomContact"]."%' OR name like '%".$_POST["NomContact"]."%' OR serial like '%".$_POST["NomContact"]."%' OR otherserial like '%".$_POST["NomContact"]."%')";
	$result = $db->query($query);
	while($ligne = $db->fetch_array($result))
	{
		$Comp_num = $ligne['ID'];
		$Contact = $ligne['contact'];
		$Computer = $ligne['name'];
		$s1 = $ligne['serial'];
		$s2 = $ligne['otherserial'];
		echo " <tr class='tab_find' onClick=\"fillidfield(".MONITOR_TYPE.",".$Comp_num.")\">";
		echo "<td width='25%' align='center'><b>&nbsp;$Contact </b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;".$lang["help"][28]."</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;$Computer </b></td>";
		echo "<td  width='25%' align='center'>";
		echo "<b>&nbsp;$Comp_num </b></td>";
		echo "<td width='25%' align='center'>";
		if ($s1!="") echo $s1;
		if ($s1!=""&&$s2!="") echo "&nbsp;/&nbsp;";
		if ($s2!="") echo $s2;
		echo "</td>";
		echo "</tr>";
	}

	$query = "select name,ID,contact, serial, otherserial from glpi_peripherals where is_template='0' AND deleted='N' AND (contact like '%".$_POST["NomContact"]."%' OR name like '%".$_POST["NomContact"]."%' OR serial like '%".$_POST["NomContact"]."%' OR otherserial like '%".$_POST["NomContact"]."%')";
	$result = $db->query($query);
	while($ligne = $db->fetch_array($result))
	{
		$Comp_num = $ligne['ID'];
		$Contact = $ligne['contact'];
		$Computer = $ligne['name'];
		$s1 = $ligne['serial'];
		$s2 = $ligne['otherserial'];
		echo " <tr class='tab_find' onClick=\"fillidfield(".PERIPHERAL_TYPE.",".$Comp_num.")\">";
		echo "<td width='25%' align='center'><b>&nbsp;$Contact </b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;".$lang["help"][29]."</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;$Computer </b></td>";
		echo "<td  width='25%' align='center'>";
		echo "<b>&nbsp;$Comp_num </b></td>";
		echo "<td width='25%' align='center'>";
		if ($s1!="") echo $s1;
		if ($s1!=""&&$s2!="") echo "&nbsp;/&nbsp;";
		if ($s2!="") echo $s2;
		echo "</td>";
		echo "</tr>";
	}

	$query = "select name,ID from glpi_software where is_template='0' AND deleted='N' AND (name like '%".$_POST["NomContact"]."%' )";
	$result = $db->query($query);
	while($ligne = $db->fetch_array($result))
	{
		$Comp_num = $ligne['ID'];
		$Computer = $ligne['name'];
		echo " <tr class='tab_find' onClick=\"fillidfield(".SOFTWARE_TYPE.",".$Comp_num.")\">";
		echo "<td width='25%' align='center'>&nbsp;</td>";
		echo "<td width='25%' align='center'><b>&nbsp;".$lang["help"][31]."</b></td>";
		echo "<td width='25%' align='center'><b>&nbsp;$Computer </b></td>";
		echo "<td  width='25%' align='center'>";
		echo "<b>&nbsp;$Comp_num </b></td>";
		echo "<td width='25%' align='center'>";
		echo "&nbsp;";
		echo "</td>";
		echo "</tr>";
	}

	echo "</table>";
}
?>
</body></html>