[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: fiche.php,v 1.36 2005/10/02 19:48:55 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/projet/fiche.php,v $ 21 */ 22 23 /** 24 \file htdocs/projet/fiche.php 25 \ingroup projet 26 \brief Fiche projet 27 \version $Revision: 1.36 $ 28 */ 29 30 require ("./pre.inc.php"); 31 require_once (DOL_DOCUMENT_ROOT."/propal.class.php"); 32 require_once (DOL_DOCUMENT_ROOT."/facture.class.php"); 33 require_once (DOL_DOCUMENT_ROOT."/commande/commande.class.php"); 34 35 if (!$user->rights->projet->lire) accessforbidden(); 36 37 if ($_POST["action"] == 'add' && $user->rights->projet->creer) 38 { 39 $pro = new Project($db); 40 $pro->socidp = $_GET["socidp"]; 41 $pro->ref = $_POST["ref"]; 42 $pro->title = $_POST["title"]; 43 $result = $pro->create($user); 44 45 if ($result > 0) 46 { 47 Header("Location:fiche.php?id=".$pro->id); 48 exit; 49 } 50 else 51 { 52 $mesg='<div class="error">'.$pro->error.'</div>'; 53 $_GET["action"] = 'create'; 54 } 55 } 56 57 if ($_POST["action"] == 'update' && $user->rights->projet->creer) 58 { 59 if (! $_POST["cancel"]) 60 { 61 if (!(empty($_POST["id"]) || empty($_POST["ref"]) || empty($_POST["title"]))) 62 { 63 $projet = new Project($db); 64 $projet->id = $_POST["id"]; 65 $projet->ref = $_POST["ref"]; 66 $projet->title = $_POST["title"]; 67 $projet->update(); 68 69 $_GET["id"]=$projet->id; // On retourne sur la fiche projet 70 } 71 else 72 { 73 $_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet 74 } 75 } 76 else 77 { 78 $_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet 79 } 80 } 81 82 if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->projet->supprimer) 83 { 84 $projet = new Project($db); 85 $projet->id = $_GET["id"]; 86 if ($projet->delete($user) == 0) 87 { 88 Header("Location: index.php"); 89 } 90 else 91 { 92 Header("Location: fiche.php?id=".$projet->id); 93 } 94 } 95 96 97 llxHeader("",$langs->trans("Project"),"Projet"); 98 99 100 if ($_GET["action"] == 'create' && $user->rights->projet->creer) 101 { 102 print_titre($langs->trans("NewProject")); 103 104 if ($mesg) print $mesg; 105 106 print '<form action="fiche.php?socidp='.$_GET["socidp"].'" method="post">'; 107 108 print '<table class="border" width="100%">'; 109 print '<input type="hidden" name="action" value="add">'; 110 print '<tr><td>'.$langs->trans("Company").'</td><td>'; 111 112 $societe = new Societe($db); 113 $societe->fetch($_GET["socidp"]); 114 print $societe->nom_url; 115 116 print '</td></tr>'; 117 118 print '<tr><td>'.$langs->trans("Author").'</td><td>'.$user->fullname.'</td></tr>'; 119 120 print '<tr><td>'.$langs->trans("Ref").'</td><td><input size="10" type="text" name="ref"></td></tr>'; 121 print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" type="text" name="title"></td></tr>'; 122 print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Create").'"></td></tr>'; 123 print '</table>'; 124 print '</form>'; 125 126 } else { 127 128 /* 129 * Fiche projet en mode visu 130 * 131 */ 132 133 $projet = new Project($db); 134 $projet->fetch($_GET["id"]); 135 $projet->societe->fetch($projet->societe->id); 136 137 $h=0; 138 $head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; 139 $head[$h][1] = $langs->trans("Project"); 140 $hselected=$h; 141 $h++; 142 143 $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$projet->id; 144 $head[$h][1] = $langs->trans("Tasks"); 145 $h++; 146 147 if ($conf->propal->enabled) 148 { 149 $langs->load("propal"); 150 $head[$h][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; 151 $head[$h][1] = $langs->trans("Proposals"); 152 $h++; 153 } 154 155 if ($conf->commande->enabled) 156 { 157 $langs->load("orders"); 158 $head[$h][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; 159 $head[$h][1] = $langs->trans("Orders"); 160 $h++; 161 } 162 163 if ($conf->facture->enabled) 164 { 165 $langs->load("bills"); 166 $head[$h][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; 167 $head[$h][1] = $langs->trans("Bills"); 168 $h++; 169 } 170 171 dolibarr_fiche_head($head, $hselected, $langs->trans("Project").": ".$projet->ref); 172 173 174 if ($_GET["action"] == 'delete') 175 { 176 $htmls = new Form($db); 177 $htmls->form_confirm("fiche.php?id=".$_GET["id"],$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete"); 178 print "<br>"; 179 } 180 181 if ($_GET["action"] == 'edit') 182 { 183 print '<form method="post" action="fiche.php">'; 184 print '<input type="hidden" name="action" value="update">'; 185 print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; 186 187 print '<table class="border" width="50%">'; 188 print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->nom_url.'</td></tr>'; 189 190 print '<tr><td>'.$langs->trans("Ref").'</td><td><input name="ref" value="'.$projet->ref.'"></td></tr>'; 191 print '<tr><td>'.$langs->trans("Label").'</td><td><input name="title" value="'.$projet->title.'"></td></tr>'; 192 print '<tr><td align="center" colspan="2"><input name="update" type="submit" Value="'.$langs->trans("Modify").'"> <input type="submit" name="cancel" Value="'.$langs->trans("Cancel").'"></td></tr>'; 193 print '</table>'; 194 print '</form>'; 195 } 196 else 197 { 198 print '<table class="border" width="100%">'; 199 200 print '<tr><td>'.$langs->trans("Company").'</td><td>'.$projet->societe->nom_url.'</td></tr>'; 201 202 print '<tr><td>'.$langs->trans("Ref").'</td><td>'.$projet->ref.'</td></tr>'; 203 print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>'; 204 print '</table>'; 205 } 206 207 print '</div>'; 208 209 /* 210 * Boutons actions 211 */ 212 print '<div class="tabsAction">'; 213 214 if ($user->rights->projet->creer == 1) 215 { 216 217 if ($_GET["action"] != "edit") 218 { 219 print '<a class="butAction" href="fiche.php?id='.$projet->id.'&action=edit">'.$langs->trans("Edit").'</a>'; 220 print '<a class="butActionDelete" href="fiche.php?id='.$projet->id.'&action=delete">'.$langs->trans("Delete").'</a>'; 221 } 222 223 } 224 225 print "</div>"; 226 227 } 228 229 $db->close(); 230 231 llxFooter('$Date: 2005/10/02 19:48:55 $ - $Revision: 1.36 $'); 232 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |