Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

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

Historique | Voir | Annoter | Télécharger (6,21 ko)

1
<?php
2
/*
3
 * @version $Id: contract.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("contract","enterprise","computer","printer","monitor","peripheral","networking","software","document","link","phone","infocom");
38
define('GLPI_ROOT', '..');
39
include (GLPI_ROOT . "/inc/includes.php");
40

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

    
43
$contract=new Contract();
44

    
45
if (isset($_POST["add"]))
46
{
47
        $contract->check(-1,'w',$_POST['FK_entities']);
48
        
49
        $newID=$contract->add($_POST);
50
        logEvent($newID, "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][20]." ".$_POST["num"].".");
51
        glpi_header($_SERVER['HTTP_REFERER']);
52
} 
53
else if (isset($_POST["delete"]))
54
{
55
        $contract->check($_POST['ID'],'w');
56

    
57
        $contract->delete($_POST);
58
        logEvent($_POST["ID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][22]);
59
        glpi_header($CFG_GLPI["root_doc"]."/front/contract.php");
60
}
61
else if (isset($_POST["restore"]))
62
{
63
        $contract->check($_POST['ID'],'w');
64

    
65
        $contract->restore($_POST);
66
        logEvent($_POST["ID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][23]);
67
        glpi_header($CFG_GLPI["root_doc"]."/front/contract.php");
68
}
69
else if (isset($_POST["purge"]))
70
{
71
        $contract->check($_POST['ID'],'w');
72

    
73
        $contract->delete($_POST,1);
74
        logEvent($_POST["ID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][24]);
75
        glpi_header($CFG_GLPI["root_doc"]."/front/contract.php");
76
}
77
else if (isset($_POST["update"]))
78
{
79
        $contract->check($_POST['ID'],'w');
80

    
81
        $contract->update($_POST);
82
        logEvent($_POST["ID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][21]);
83
        glpi_header($_SERVER['HTTP_REFERER']);
84
} 
85
else if (isset($_POST["additem"]))
86
{
87
        if (strstr($_SERVER['HTTP_REFERER'], $_SERVER['SCRIPT_NAME'])) {
88
                // error_log("update from contract form");
89
                $contract->check($_POST['conID'],'w');
90
        } else {
91
                // error_log("update from infocom form of an equipement");
92
                checkRight("contract_infocom","w");
93
        }
94

    
95
        if ($_POST['type']>0&&$_POST['item']>0){
96
                addDeviceContract($_POST["conID"],$_POST['type'],$_POST['item']);
97
                logEvent($_POST["conID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][32]);
98
        }
99
        glpi_header($_SERVER['HTTP_REFERER']);
100
}
101
else if (isset($_POST["deleteitem"]))
102
{
103
        // delete item from massive action menu
104
        
105
        if (strstr($_SERVER['HTTP_REFERER'], $_SERVER['SCRIPT_NAME'])) {
106
                // error_log("update from contract form");
107
                $contract->check($_POST['conID'],'w');
108
        } else {
109
                // error_log("update from infocom form of an equipement");
110
                checkRight("contract_infocom","w");
111
        }
112

    
113
        if (count($_POST["item"]))
114
                foreach ($_POST["item"] as $key => $val)
115
                        deleteDeviceContract($key);
116

    
117
        logEvent($_POST["conID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][33]);
118
        glpi_header($_SERVER['HTTP_REFERER']);
119
}
120
else if (isset($_GET["deleteitem"]))
121
{
122
        // delete single item from url on list
123
        
124
        if (strstr($_SERVER['HTTP_REFERER'], $_SERVER['SCRIPT_NAME'])) {
125
                // error_log("update from contract form");
126
                $contract->check($_GET['conID'],'w');
127
        } else {
128
                // error_log("update from infocom form of an equipement");
129
                checkRight("contract_infocom","w");
130
        }
131

    
132
        deleteDeviceContract($_GET["ID"]);
133

    
134
        logEvent($_GET["conID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][33]);
135
        glpi_header($_SERVER['HTTP_REFERER']);
136
}
137
else if (isset($_POST["addenterprise"]))
138
{
139
        $contract->check($_POST['conID'],'w');
140

    
141
        addEnterpriseContract($_POST["conID"],$_POST["entID"]);
142
        logEvent($_POST["conID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][34]);
143
        glpi_header($_SERVER['HTTP_REFERER']);
144
}
145
else if (isset($_GET["deleteenterprise"]))
146
{
147
        $contract->check($_GET['conID'],'w');
148

    
149
        deleteEnterpriseContract($_GET["ID"]);
150
        logEvent($_GET["ID"], "contracts", 4, "financial", $_SESSION["glpiname"]." ".$LANG["log"][35]);
151
        glpi_header($_SERVER['HTTP_REFERER']);
152
}
153
else
154
{
155
        $contract->check($_GET["ID"],'r');
156

    
157
        if (!isset($_SESSION['glpi_onglet'])) $_SESSION['glpi_onglet']=1;
158
        if (isset($_GET['onglet'])) {
159
                $_SESSION['glpi_onglet']=$_GET['onglet'];
160
        }
161

    
162
        commonHeader($LANG["Menu"][25],$_SERVER['PHP_SELF'],"financial","contract");
163

    
164
        if ($contract->showForm($_SERVER['PHP_SELF'],$_GET["ID"])) {
165
                if ($_GET['ID']>0){
166
                        switch($_SESSION['glpi_onglet']){
167
                                case -1 :        
168
                                        showEnterpriseContract($_GET["ID"]);
169
                                        showDeviceContract($_GET["ID"]);
170
                                        showDocumentAssociated(CONTRACT_TYPE,$_GET["ID"]);
171
                                        showLinkOnDevice(CONTACT_TYPE,$_GET["ID"]);
172
                                        displayPluginAction(CONTRACT_TYPE,$_GET["ID"],$_SESSION['glpi_onglet']);
173
                                        break;
174
                                case 5 : 
175
                                        showDocumentAssociated(CONTRACT_TYPE,$_GET["ID"]);
176
                                        break;
177
                                case 7 : 
178
                                        showLinkOnDevice(CONTRACT_TYPE,$_GET["ID"]);
179
                                        break;
180
                                case 10 :
181
                                        showNotesForm($_SERVER['PHP_SELF'],CONTRACT_TYPE,$_GET["ID"]);
182
                                        break;
183
                                default :
184
                                        if (!displayPluginAction(CONTRACT_TYPE,$_GET["ID"],$_SESSION['glpi_onglet'])){
185
                                                showEnterpriseContract($_GET["ID"]);
186
                                                showDeviceContract($_GET["ID"]);
187
                                        }
188
                                        break;
189
                        }
190
                }
191
        }        
192
        commonFooter();
193
}
194

    
195
?>
Redmine Appliance - Powered by TurnKey Linux