Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / ajax / dropdownInstallLicense.php @ b67d8923

Historique | Voir | Annoter | Télécharger (3,39 ko)

1
<?php
2
/*
3
 * @version $Id: dropdownInstallLicense.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: Julien Dombre
33
// Purpose of file:
34
// ----------------------------------------------------------------------
35

    
36

    
37
define('GLPI_ROOT','..');
38
$AJAX_INCLUDE=1;
39
$NEEDED_ITEMS=array("software","computer");
40
include (GLPI_ROOT."/inc/includes.php");
41

    
42
header("Content-Type: text/html; charset=UTF-8");
43
header_nocache();
44

    
45
checkRight("software","w");
46

    
47
if ($_POST['sID']>0){
48
        // Make a select box
49

    
50
        $where="";
51
        if (!$_POST["only_globalfree"]){
52
                $where=" glpi_inst_software.cID IS NULL OR glpi_inst_software.cID = 0 OR ";
53
        }
54
        $query = "SELECT DISTINCT glpi_licenses.* from glpi_licenses ";
55
        $query.= " LEFT JOIN glpi_inst_software on (glpi_licenses.ID=glpi_inst_software.license)";
56
        $query.= " WHERE glpi_licenses.sID='".$_POST['sID']."' AND ($where glpi_licenses.serial='free' OR glpi_licenses.serial='global' ) ";
57
        $query.= " GROUP BY version, serial, expire, oem, oem_computer, buy ORDER BY version, serial ASC";
58

    
59

    
60
        $result = $DB->query($query);
61
        $number=$DB->numrows($result);
62
        echo "<select name=\"".$_POST['myname']."\" size='1'>";
63

    
64

    
65
        echo "<option value=\"0\">-----</option>";
66

    
67
        if ($number==0&&!isGlobalSoftware($_POST["sID"])&&!isFreeSoftware($_POST["sID"]))
68
                echo "<option value=\"-1\">--".$LANG["software"][43]."--</option>";
69

    
70
        $today=date("Y-m-d"); 
71
        if ($number) {
72
                while ($data = $DB->fetch_assoc($result)) {
73

    
74
                        $output = $data['version']." ".$data['serial']." - ";
75

    
76
                        $expirer=0;
77
                        if ($data['expire']!=NULL&&$today>$data['expire']) $expirer=1; 
78

    
79
                        if ($data['expire']==NULL)
80
                                $output.= $LANG["software"][26];
81
                        else {
82
                                if ($expirer) $output.= $LANG["software"][27];
83
                                else $output.= $LANG["software"][25]."&nbsp;".$data['expire'];
84
                        }
85

    
86
                        if ($data['buy'])
87
                                $output.=" - ".$LANG["software"][35];
88
                        else 
89
                                $output.=" - ".$LANG["software"][37];
90

    
91
                        if ($data['oem']){
92
                                $comp=new Computer();
93
                                $comp->getFromDB($data["oem_computer"]);
94
                                $output.=" - ".$LANG["software"][28]. " ".$comp->fields['name'];
95
                                if ($CFG_GLPI["view_ID"]) $output.=" (".$comp->fields['ID'].")";
96
                        }
97

    
98

    
99
                        $ID = $data['ID'];
100
                        if (empty($output)) $output="($ID)";
101
                        echo "<option value=\"$ID\" title=\"".cleanInputText($output)."\">".$output."</option>";
102
                }
103
        } 
104
        echo "</select>&nbsp;";
105
}
106

    
107
?>
Redmine Appliance - Powered by TurnKey Linux