Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / install / update_to_031.php @ b67d8923

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

1
<?php
2
/*
3
 * @version $Id: update_to_031.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
///update the database to the 0.31 version
37
function updateDbTo031(){
38
        global $DB,$LANG;
39

    
40
        //amSize ramSize
41
        $query = "Alter table users drop can_assign_job";
42
        $DB->query($query) or die($LANG["update"][90].$DB->error());
43
        $query = "Alter table users add can_assign_job enum('yes','no') NOT NULL default 'no'";
44
        $DB->query($query) or die($LANG["update"][90].$DB->error());
45
        $query = "Update users set can_assign_job = 'yes' where type = 'admin'";
46
        $DB->query($query) or die($LANG["update"][90].$DB->error());
47

    
48
        echo "<p class='center'>Version 0.2 & < </p>";
49

    
50
        //Version 0.21 ajout du champ ramSize a la table printers si non existant.
51

    
52

    
53
        if(!FieldExists("printers", "ramSize")) {
54
                $query = "alter table printers add ramSize varchar(6) NOT NULL default ''";
55
                $DB->query($query) or die($LANG["update"][90].$DB->error());
56
        }
57

    
58
        echo "<p class='center'>Version 0.21  </p>";
59

    
60
        //Version 0.3
61
        //Ajout de NOT NULL et des valeurs par defaut.
62

    
63
        $query = "ALTER TABLE computers MODIFY achat_date date NOT NULL default '0000-00-00'";
64
        $DB->query($query) or die($LANG["update"][90].$DB->error());
65
        $query = "ALTER TABLE computers MODIFY date_fin_garantie date NOT NULL default '0000-00-00'";
66

    
67

    
68
        $query = "ALTER TABLE monitors MODIFY achat_date date NOT NULL default '0000-00-00'";
69
        $DB->query($query) or die($LANG["update"][90].$DB->error());
70
        $query = "ALTER TABLE monitors MODIFY date_fin_garantie date NOT NULL default '0000-00-00'";
71

    
72
        $query = "ALTER TABLE networking MODIFY achat_date date NOT NULL default '0000-00-00'";
73
        $DB->query($query) or die($LANG["update"][90].$DB->error());
74
        $query = "ALTER TABLE networking MODIFY date_fin_garantie date NOT NULL default '0000-00-00'";
75

    
76

    
77
        $query = "ALTER TABLE printers MODIFY achat_date date NOT NULL default '0000-00-00'";
78
        $DB->query($query) or die($LANG["update"][90].$DB->error());
79
        $query = "ALTER TABLE printers MODIFY date_fin_garantie date NOT NULL default '0000-00-00'";
80

    
81
        $query = "ALTER TABLE templates MODIFY achat_date date NOT NULL default '0000-00-00'";
82
        $DB->query($query) or die($LANG["update"][90].$DB->error());
83
        $query = "ALTER TABLE templates MODIFY date_fin_garantie date NOT NULL default '0000-00-00'";
84

    
85
        echo "<p class='center'>Version 0.3  </p>";
86
}
87
?>
Redmine Appliance - Powered by TurnKey Linux