Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / front / enterprise.form.php @ b67d8923

Historique | Voir | Annoter | Télécharger (5,69 ko)

1
<?php
2
/*
3
 * @version $Id: enterprise.form.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
$NEEDED_ITEMS=array("enterprise","contact","document","contract","tracking","user","group","computer","printer","monitor","peripheral","networking","software","link","phone","infocom","device");
38

    
39
define('GLPI_ROOT', '..');
40
include (GLPI_ROOT . "/inc/includes.php");
41

    
42
if(!isset($_GET["ID"])) $_GET["ID"] = -1;
43

    
44
if (!isset($_GET["start"])) {
45
        $_GET["start"]=0;
46
}
47

    
48
if (!isset($_GET["sort"])) $_GET["sort"]="";
49
if (!isset($_GET["order"])) $_GET["order"]="";
50

    
51
$ent=new Enterprise();
52
if (isset($_POST["add"]))
53
{
54
        $ent->check(-1,'w',$_POST['FK_entities']);
55

    
56
        $newID=$ent->add($_POST);
57
        logEvent($newID, "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][20]." ".$_POST["name"].".");
58
        glpi_header($_SERVER['HTTP_REFERER']);
59
} 
60
else if (isset($_POST["delete"]))
61
{
62
        $ent->check($_POST["ID"],'w');
63

    
64
        $ent->delete($_POST);
65
        logEvent($_POST["ID"], "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][22]);
66
        glpi_header($CFG_GLPI["root_doc"]."/front/enterprise.php");
67
}
68
else if (isset($_POST["restore"]))
69
{
70
        $ent->check($_POST["ID"],'w');
71

    
72
        $ent->restore($_POST);
73
        logEvent($_POST["ID"], "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][23]);
74
        glpi_header($CFG_GLPI["root_doc"]."/front/enterprise.php");
75
}
76
else if (isset($_POST["purge"]))
77
{
78
        $ent->check($_POST["ID"],'w');
79

    
80
        $ent->delete($_POST,1);
81
        logEvent($_POST["ID"], "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][24]);
82
        glpi_header($CFG_GLPI["root_doc"]."/front/enterprise.php");
83
}
84
else if (isset($_POST["update"]))
85
{
86
        $ent->check($_POST["ID"],'w');
87

    
88
        $ent->update($_POST);
89
        logEvent($_POST["ID"], "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][21]);
90
        glpi_header($_SERVER['HTTP_REFERER']);
91
} 
92
else if (isset($_POST["addcontact"]))
93
{
94
        $ent->check($_POST["eID"],'w');
95

    
96
        addContactEnterprise($_POST["eID"],$_POST["cID"]);
97
        logEvent($_POST["eID"], "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][36]);
98
        glpi_header($_SERVER['HTTP_REFERER']);
99
}
100
else if (isset($_GET["deletecontact"]))
101
{
102
        $ent->check($_GET["eID"],'w');
103

    
104
        deleteContactEnterprise($_GET["ID"]);
105
        logEvent($_GET["eID"], "enterprises", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][37]);
106
        glpi_header($_SERVER['HTTP_REFERER']);
107
}
108
else if (isset($_POST["addcontract"]))
109
{
110
        $ent->check($_POST["entID"],'w');
111

    
112
        addEnterpriseContract($_POST["conID"],$_POST["entID"]);
113
        logEvent($_POST["conID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][34]);
114
        glpi_header($_SERVER['HTTP_REFERER']);
115
}
116
else if (isset($_GET["deletecontract"]))
117
{
118
        $ent->check($_GET["entID"],'w');
119

    
120
        deleteEnterpriseContract($_GET["ID"]);
121
        logEvent($_GET["ID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][35]);
122
        glpi_header($_SERVER['HTTP_REFERER']);
123
}
124
else
125
{
126
        $ent->check($_GET["ID"],'r');
127

    
128
        if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1;
129
        if (isset($_GET['onglet'])) {
130
                $_SESSION['glpi_onglet']=$_GET['onglet'];
131
        }
132

    
133

    
134
        commonHeader($LANG["Menu"][23],$_SERVER['PHP_SELF'],"financial","enterprise");
135

    
136

    
137
        if ($ent->showForm($_SERVER['PHP_SELF'],$_GET["ID"])){
138
                if ($_GET["ID"]>0){
139
                        switch($_SESSION['glpi_onglet']){
140
                                case -1:
141
                                        showAssociatedContact($_GET["ID"]);
142
                                        showContractAssociatedEnterprise($_GET["ID"]);
143
                                        showDocumentAssociated(ENTERPRISE_TYPE,$_GET["ID"]);
144
                                        showTrackingList($_SERVER['PHP_SELF'],$_GET["start"],$_GET["sort"],$_GET["order"],"all",'','',0,0,0,0,0,$_GET["ID"]);
145
                                        showLinkOnDevice(ENTERPRISE_TYPE,$_GET["ID"]);
146
                                        displayPluginAction(ENTERPRISE_TYPE,$_GET["ID"],$_SESSION['glpi_onglet']);
147
                                        break;
148
                                case 1 :
149
                                        showAssociatedContact($_GET["ID"]);
150
                                        break;
151
                                case 4 :
152
                                        showContractAssociatedEnterprise($_GET["ID"]);
153
                                        break;
154
                                case 5 :
155
                                        showDocumentAssociated(ENTERPRISE_TYPE,$_GET["ID"],0);
156
                                        break;
157
                                case 6 :
158
                                        showTrackingList($_SERVER['PHP_SELF']."?ID=".$_GET["ID"],$_GET["start"],$_GET["sort"],$_GET["order"],"all",'','',0,0,0,0,0,$_GET["ID"]);
159
                                        break;
160
                                case 7 : 
161
                                        showLinkOnDevice(ENTERPRISE_TYPE,$_GET["ID"]);
162
                                        break;
163
                                case 10 :
164
                                        showNotesForm($_SERVER['PHP_SELF'],ENTERPRISE_TYPE,$_GET["ID"]);
165
                                        break;        
166
                                case 15 :
167
                                        showInfocomEnterprise($_GET["ID"]);
168
                                        break;        
169
                                default : 
170
                                        if (!displayPluginAction(ENTERPRISE_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'])){
171
                                                showAssociatedContact($_GET["ID"]);
172
                                        }
173
                                        break;
174
                        }
175
                }
176
        }
177
        commonFooter();
178
}
179

    
180
?>
Redmine Appliance - Powered by TurnKey Linux