| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: fiche.php,v 1.5 2005/09/02 11:48:45 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/service/fiche.php,v $ 20 * 21 */ 22 23 require "./pre.inc.php"; 24 25 if (!$user->rights->telephonie->service->lire) 26 accessforbidden(); 27 28 $mesg = ''; 29 30 31 if ($_POST["action"] == 'add') 32 { 33 $service = new TelephonieService($db); 34 35 $service->ref = $_POST["ref"]; 36 $service->libelle = $_POST["libelle"]; 37 $service->libelle_facture = $_POST["libelle_facture"]; 38 $service->montant = $_POST["montant"]; 39 40 if ( $service->create($user) == 0) 41 { 42 Header("Location: fiche.php?id=".$service->id); 43 } 44 else 45 { 46 $_GET["action"] = 'create'; 47 } 48 49 } 50 51 52 if ($_GET["action"] == 'active') 53 { 54 $service = new TelephonieService($db); 55 $service->id = $_GET["id"]; 56 57 if ( $service->active($user) == 0) 58 { 59 Header("Location: fiche.php?id=".$service->id); 60 } 61 62 } 63 64 if ($_POST["action"] == 'update') 65 { 66 $service = new TelephonieService($db); 67 $service->id = $_GET["id"]; 68 69 $service->ref = $_POST["ref"]; 70 $service->libelle = $_POST["libelle"]; 71 $service->libelle_facture = $_POST["libelle_facture"]; 72 $service->montant = $_POST["montant"]; 73 74 if ( $service->update($user) == 0) 75 76 { 77 $action = ''; 78 $mesg = 'Fiche mise à jour'; 79 } 80 else 81 { 82 $action = 're-edit'; 83 $mesg = 'Fiche non mise à jour !' . "<br>" . $entrepot->mesg_error; 84 } 85 } 86 87 88 llxHeader("","Téléphonie - Fiche Service"); 89 90 if ($cancel == $langs->trans("Cancel")) 91 { 92 $action = ''; 93 } 94 95 /* 96 * Création 97 * 98 */ 99 if ($_GET["action"] == 'create') 100 { 101 $form = new Form($db); 102 print_titre("Nouveau service"); 103 104 print '<form action="fiche.php" method="POST">'; 105 print '<input type="hidden" name="action" value="add">'; 106 107 print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; 108 109 print '<tr><td>Libellé</td><td>'; 110 print '<input type="text" size="30" name="libelle">'; 111 print '</td></tr>'; 112 113 print '<tr><td>Libellé Facture</td><td>'; 114 print '<input type="text" size="50" name="libelle_facture">'; 115 print '</td></tr>'; 116 117 print '<tr><td>Montant HT</td><td>'; 118 print '<input type="text" size="8" name="montant">'; 119 print ' euros HT</td></tr>'; 120 121 print '<tr><td> </td><td><input type="submit" value="Créer"></td></tr>'."\n"; 122 print '</table>'."\n"; 123 print '</form>'; 124 125 126 127 } 128 else 129 { 130 if ($_GET["id"]) 131 { 132 133 $service = new TelephonieService($db); 134 135 if ( $service->fetch($_GET["id"]) == 0 ) 136 { 137 if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') 138 { 139 140 $h=0; 141 $head[$h][0] = DOL_URL_ROOT."/telephonie/service/fiche.php?id=".$service->id; 142 $head[$h][1] = $langs->trans("Service"); 143 $hselected = $h; 144 $h++; 145 146 $head[$h][0] = DOL_URL_ROOT."/telephonie/service/contrats.php?id=".$service->id; 147 $head[$h][1] = "Contrats"; 148 $h++; 149 150 dolibarr_fiche_head($head, $hselected, 'Service : '.$service->id); 151 152 print_fiche_titre('Fiche Service', $mesg); 153 154 print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; 155 156 print '<tr><td width="20%">Libellé</td><td>'.$service->libelle.'</td></tr>'; 157 print '<tr><td width="20%">Libellé Facture</td><td>'.$service->libelle_facture.'</td></tr>'; 158 159 print '<tr><td width="20%">Montant mensuel HT</td><td>'.$service->montant.'</td></tr>'; 160 print '<tr><td width="20%">Statut</td><td>'.$service->statuts[$service->statut].'</td></tr>'; 161 print "</table><br />"; 162 print '</div>'; 163 } 164 165 166 /* 167 * Edition 168 * 169 * 170 * 171 */ 172 173 if ($_GET["action"] == 'edit' || $action == 're-edit') 174 { 175 176 $h=0; 177 $head[$h][0] = DOL_URL_ROOT."/telephonie/service/fiche.php?id=".$service->id; 178 $head[$h][1] = $langs->trans("Service"); 179 $hselected = $h; 180 $h++; 181 182 dolibarr_fiche_head($head, $hselected, 'Service : '.$service->numero); 183 184 print_fiche_titre('Edition du service', $mesg); 185 186 print "<form action=\"fiche.php?id=$service->id\" method=\"post\">\n"; 187 print '<input type="hidden" name="action" value="update">'; 188 189 print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; 190 191 192 print '<tr><td width="20%">Libellé</td><td>'; 193 print '<input name="libelle" size="20" value="'.$service->libelle.'">'; 194 print '</td></tr>'; 195 196 print '<tr><td width="20%">Libellé Facture</td><td>'; 197 print '<input name="libelle_facture" size="20" value="'.$service->libelle_facture.'">'; 198 print '</td></tr>'; 199 200 print '<tr><td width="20%">Montant mensuel HT</td><td>'; 201 print '<input name="montant" size="20" value="'.$service->montant.'"> euros HT'; 202 print '</td></tr>'; 203 204 print '<tr><td align="center" colspan="2"><input type="submit">'; 205 print '</td></tr>'; 206 207 print '</table>'; 208 209 print '</div>'; 210 211 } 212 } 213 else 214 { 215 print "Error"; 216 } 217 } 218 } 219 220 221 222 /* ************************************************************************** */ 223 /* */ 224 /* Barre d'action */ 225 /* */ 226 /* ************************************************************************** */ 227 228 print "\n<div class=\"tabsAction\">\n"; 229 230 if ($_GET["action"] == '' && $service->statut == 0) 231 { 232 print "<a class=\"tabAction\" href=\"fiche.php?action=active&id=$service->id\">".$langs->trans("Active")."</a>"; 233 } 234 235 236 if ($_GET["action"] == '') 237 { 238 print "<a class=\"tabAction\" href=\"fiche.php?action=edit&id=$service->id\">".$langs->trans("Edit")."</a>"; 239 } 240 241 242 243 print "</div>"; 244 245 246 247 $db->close(); 248 249 llxFooter("<em>Dernière modification $Date: 2005/09/02 11:48:45 $ révision $Revision: 1.5 $</em>"); 250 ?>
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 |
|