| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Brian Fraval <brian@fraval.org> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 5 * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * 21 * $Id: new.php,v 1.8 2005/12/07 11:29:21 rodolphe Exp $ 22 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/new.php,v $ 23 * 24 */ 25 26 /** 27 \file htdocs/telephonie/client/new.php 28 \ingroup telephonie 29 \brief Creation d'un nouveau client 30 \version $Revision: 1.8 $ 31 */ 32 33 require ("pre.inc.php"); 34 35 if (!$user->rights->telephonie->ligne->creer) accessforbidden(); 36 37 require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); 38 require_once(DOL_DOCUMENT_ROOT.'/companybankaccount.class.php'); 39 require_once(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); 40 require_once(DOL_DOCUMENT_ROOT."/telephonie/telephonie.contrat.class.php"); 41 42 $user->getrights('societe'); 43 $langs->load("companies"); 44 45 $soc = new Societe($db); 46 $contact = new Contact($db); 47 $rib = new CompanyBankAccount($db, 0); 48 49 /* 50 * Actions 51 */ 52 53 if ($_POST["action"] == 'add') 54 { 55 $error = 0; 56 $verif = "ok"; 57 $mesg = ''; 58 59 60 $contact->name = $_POST["cnom"]; 61 $contact->firstname = $_POST["cprenom"]; 62 $contact->email = strtolower($_POST["cmail"]); 63 64 if (strlen(trim($_POST["nom"])) == 0) 65 { 66 $mesg = "Nom de société incorrect"; 67 $verif = "nok"; 68 } 69 70 if (strlen(trim($_POST["code_client"])) <> 6 && $verif == 'ok') 71 { 72 $mesg = "Code client incorrect"; 73 $verif = "nok"; 74 } 75 76 if (strlen(trim($_POST["adresse"])) == 0 && $verif == 'ok') 77 { 78 $mesg = "Adresse de société manquante"; 79 $verif = "nok"; 80 } 81 82 if (strlen(trim($_POST["cp"])) == 0 && $verif == 'ok') 83 { 84 $mesg = "Code postal manquant"; 85 $verif = "nok"; 86 } 87 88 if (strlen(trim($_POST["ville"])) == 0 && $verif == 'ok') 89 { 90 $mesg = "Ville manquante"; 91 $verif = "nok"; 92 } 93 94 $rib->code_banque = $_POST["rib_banque"]; 95 $rib->code_guichet = $_POST["rib_guichet"]; 96 $rib->number = $_POST["rib_compte"]; 97 $rib->cle_rib = $_POST["rib_cle"]; 98 $rib->iban_prefix = $_POST["rib_iban"]; 99 $rib->proprio = $_POST["titulaire"]; 100 101 102 if ((strlen(trim($_POST["rib_banque"])) + strlen(trim($_POST["rib_guichet"])) + strlen(trim($_POST["rib_compte"])) + strlen(trim($_POST["rib_cle"])))<> 0 && $verif == 'ok') 103 { 104 if (strlen(trim($_POST["rib_banque"])) <> 5 && $verif == 'ok') 105 { 106 $mesg = "Rib code banque incomplet"; 107 $verif = "nok"; 108 } 109 110 if (strlen(trim($_POST["rib_guichet"])) <> 5 && $verif == 'ok') 111 { 112 $mesg = "Rib code agence incomplet"; 113 $verif = "nok"; 114 } 115 116 if (strlen(trim($_POST["titulaire"])) == 0 && $verif == 'ok') 117 { 118 $mesg = "Vous devez indiquer le titulaire du compte"; 119 $verif = "nok"; 120 } 121 122 if ($rib->verif() <> 1 && $verif == 'ok') 123 { 124 $mesg = "Rib incorrect ".$rib->error_message; 125 $verif = "nok"; 126 } 127 } 128 129 if (strlen(trim($_POST["cmail"])) > 0 && $verif == 'ok') 130 { 131 132 if (strlen(trim($_POST["cnom"])) == 0 && $verif == 'ok') 133 { 134 $mesg = "Nom de contact manquant"; 135 $verif = "nok"; 136 } 137 138 if (!ValidEmail(trim($contact->email)) && $verif == 'ok') 139 { 140 $mesg = "Email invalide"; 141 $verif = "nok"; 142 } 143 144 if (!check_mail(trim($contact->email)) && $verif == 'ok') 145 { 146 $mesg = "Email invalide (domaine invalide)"; 147 $verif = "nok"; 148 } 149 } 150 151 152 if (strlen(trim($_POST["cli"])) <> 9 && $verif == 'ok') 153 { 154 $mesg = "Numéro de ligne #1 (0".$_POST["cli"].") incorrect"; 155 $verif = "nok"; 156 } 157 158 $p = array("1","2","3","4","5"); 159 160 if (!in_array(substr(trim($_POST["cli"]),0,1), $p) && $verif == 'ok') 161 { 162 $mesg = "Numéro de ligne #1 (0".$_POST["cli"].") incorrect"; 163 $verif = "nok"; 164 } 165 166 /* Ligne #2 */ 167 168 if (strlen(trim($_POST["cli2"])) > 0 && $verif == 'ok') 169 { 170 if (strlen(trim($_POST["cli2"])) <> 9 && $verif == 'ok') 171 { 172 $mesg = "Numéro de ligne #2 (0".$_POST["cli2"].") incorrect"; 173 $verif = "nok"; 174 } 175 176 if (!in_array(substr(trim($_POST["cli2"]),0,1), $p) && $verif == 'ok') 177 { 178 $mesg = "Numéro de ligne #2 (0".$_POST["cli2"].") incorrect"; 179 $verif = "nok"; 180 } 181 } 182 /* Ligne #3 */ 183 184 if (strlen(trim($_POST["cli3"])) > 0 && $verif == 'ok') 185 { 186 if (strlen(trim($_POST["cli3"])) <> 9 && $verif == 'ok') 187 { 188 $mesg = "Numéro de ligne #3 (0".$_POST["cli3"].") incorrect"; 189 $verif = "nok"; 190 } 191 192 if (!in_array(substr(trim($_POST["cli3"]),0,1), $p) && $verif == 'ok') 193 { 194 $mesg = "Numéro de ligne #3 (0".$_POST["cli3"].") incorrect"; 195 $verif = "nok"; 196 } 197 } 198 199 /* Verif Tarif */ 200 if (strlen(trim($_POST["france"])) > 0 && $verif == "ok") 201 { 202 $temporel = ereg_replace(",",".",trim($_POST["france"])); 203 204 if(! is_numeric($temporel)) 205 { 206 $error = 1030; 207 $verif = "nok"; 208 $mesg .= "Tarif France Invalide"; 209 } 210 else 211 { 212 if ($temporel > 0.04 ) 213 { 214 $error = 1031; 215 $verif = "nok"; 216 $mesg .= "Tarif France Invalide : $temporel > 0.04 !"; 217 } 218 219 if ($temporel < 0.016 ) 220 { 221 $error = 1031; 222 $verif = "nok"; 223 $mesg .= "Tarif France Invalide : $temporel < 0.016 !"; 224 } 225 } 226 } 227 if (strlen(trim($_POST["mobil"])) > 0 && $verif == "ok") 228 { 229 $temporel = ereg_replace(",",".",trim($_POST["mobil"])); 230 231 if(! is_numeric($temporel)) 232 { 233 $error++; 234 $verif = "nok"; 235 $mesg .= "Tarif Mobile Invalide"; 236 } 237 else 238 { 239 if ($temporel > 0.40 ) 240 { 241 $error = 1033; 242 $verif = "nok"; 243 $mesg .= "Tarif Mobile Invalide : $temporel > 0.40 !"; 244 } 245 if ($temporel < 0.16 ) 246 { 247 $error = 1034; 248 $verif = "nok"; 249 $mesg .= "Tarif Mobile Invalide : $temporel < 0.16 !"; 250 } 251 } 252 } 253 254 /* Fin Verif Tarif */ 255 256 $soc->nom = stripslashes($_POST["nom"]); 257 $soc->adresse = stripslashes($_POST["adresse"]); 258 $soc->cp = stripslashes($_POST["cp"]); 259 $soc->ville = stripslashes($_POST["ville"]); 260 $soc->pays_id = stripslashes($_POST["pays_id"]); 261 $soc->tel = stripslashes($_POST["tel"]); 262 $soc->fax = stripslashes($_POST["fax"]); 263 $soc->url = ereg_replace( "http://", "", $_POST["url"] ); 264 $soc->code_client = $_POST["code_client"]; 265 $soc->code_fournisseur = stripslashes($_POST["code_fournisseur"]); 266 $soc->codeclient_modifiable = stripslashes($_POST["codeclient_modifiable"]); 267 $soc->codefournisseur_modifiable = stripslashes($_POST["codefournisseur_modifiable"]); 268 $soc->client = 1; 269 $soc->fournisseur = 0; 270 271 if (!$error && $verif == "ok") 272 { 273 $soc->code_client = $_POST["code_client"]."00"; 274 $result = $soc->create($user); 275 276 if ($result == 0) 277 { 278 $soc->AddPerms(1,1,1,1); 279 $soc->AddPerms(5,1,1,1); 280 $soc->AddPerms(9,1,1,1); 281 $soc->AddPerms(16,1,1,1); 282 $soc->AddPerms($_POST["commercial_sign"],1,0,0); 283 } 284 else 285 { 286 $mesg = nl2br($soc->error) . " (result $result)\n"; 287 $error = 1035; 288 } 289 } 290 291 if (!$error && $verif == "ok") 292 { 293 $contact->socid = $soc->id; 294 295 if ( $contact->create($user) > 0) 296 { 297 298 } 299 else 300 { 301 $error = 1024; 302 } 303 } 304 305 306 if ((strlen(trim($_POST["rib_banque"])) + strlen(trim($_POST["rib_guichet"])) + strlen(trim($_POST["rib_compte"])) + strlen(trim($_POST["rib_cle"])))<> 0 && $verif == 'ok' && !$error) 307 { 308 $rib->soc_id = $soc->id; 309 310 if ( $rib->update($user) > 0) 311 { 312 313 } 314 else 315 { 316 $error = 1025; 317 } 318 } 319 320 if (!$error && $verif == "ok") 321 { 322 $contrat = new TelephonieContrat($db); 323 324 $contrat->client_comm = $soc->id; 325 $contrat->client = $soc->id; 326 $contrat->client_facture = $soc->id; 327 $contrat->commercial_sign = $_POST["commercial_sign"]; 328 329 if ( $contrat->create($user,'oui',$_POST["mode_paiement"]) == 0) 330 { 331 $contrat->add_contact_facture($contact->id); 332 } 333 else 334 { 335 $error = 1026; 336 } 337 } 338 339 if(!$error && $verif == "ok") 340 { 341 $contrat->commercial_sign_id = $_POST["commercial_sign"]; 342 $contrat->addpo($_POST["montantpo"], $user); 343 } 344 345 $ligne = new LigneTel($db); 346 $ligne->contrat = $contrat->id; 347 $ligne->numero = "0".$_POST["cli"]; 348 $ligne->client_comm = $soc->id; 349 $ligne->client = $soc->id; 350 $ligne->client_facture = $soc->id; 351 $ligne->fournisseur = $_POST["fournisseur"]; 352 $ligne->commercial_sign = $_POST["commercial_sign"]; 353 $ligne->commercial_suiv = $_POST["commercial_sign"]; 354 $ligne->concurrent = $_POST["concurrent"]; 355 $ligne->remise = "0"; 356 $ligne->note = $_POST["note"]; 357 358 if(!$error && $verif == "ok") 359 { 360 if (strlen(trim($_POST["cli"])) == 9) 361 { 362 363 if ( $ligne->create($user) == 0) 364 { 365 366 } 367 else 368 { 369 $error = 1027; 370 $mesg.= "Impossible de créer la ligne #1 0".$_POST["cli"]; 371 } 372 } 373 } 374 375 /* Ligne 2 */ 376 377 $ligne = new LigneTel($db); 378 $ligne->contrat = $contrat->id; 379 $ligne->numero = "0".$_POST["cli2"]; 380 $ligne->client_comm = $soc->id; 381 $ligne->client = $soc->id; 382 $ligne->client_facture = $soc->id; 383 $ligne->fournisseur = $_POST["fournisseur"]; 384 $ligne->commercial_sign = $_POST["commercial_sign"]; 385 $ligne->commercial_suiv = $_POST["commercial_sign"]; 386 $ligne->concurrent = $_POST["concurrent"]; 387 $ligne->remise = "0"; 388 $ligne->note = $_POST["note"]; 389 390 if(!$error && $verif == "ok") 391 { 392 if (strlen(trim($_POST["cli2"])) == 9) 393 { 394 395 if ( $ligne->create($user) == 0) 396 { 397 398 } 399 else 400 { 401 //$error++; 402 $error = 1028; 403 $mesg.= "Impossible de créer la ligne #2 0".$_POST["cli2"]; 404 } 405 } 406 } 407 408 /* Ligne 3 */ 409 $ligne = new LigneTel($db); 410 $ligne->contrat = $contrat->id; 411 $ligne->numero = "0".$_POST["cli3"]; 412 $ligne->client_comm = $soc->id; 413 $ligne->client = $soc->id; 414 $ligne->client_facture = $soc->id; 415 $ligne->fournisseur = $_POST["fournisseur"]; 416 $ligne->commercial_sign = $_POST["commercial_sign"]; 417 $ligne->commercial_suiv = $_POST["commercial_sign"]; 418 $ligne->concurrent = $_POST["concurrent"]; 419 $ligne->remise = "0"; 420 $ligne->note = $_POST["note"]; 421 422 if(!$error && $verif == "ok") 423 { 424 if (strlen(trim($_POST["cli3"])) == 9) 425 { 426 427 if ( $ligne->create($user) == 0) 428 { 429 430 } 431 else 432 { 433 //$error++; 434 $error = 1029; 435 $mesg.= "Impossible de créer la ligne #3 0".$_POST["cli3"]; 436 } 437 } 438 } 439 440 /* DEBUT TARIFS */ 441 if (strlen(trim($_POST["france"])) > 0 && $verif == "ok") 442 { 443 $temporel = ereg_replace(",",".",trim($_POST["france"])); 444 445 if (!$error) 446 { 447 $db->begin(); 448 449 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; 450 $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; 451 $sql .= " (1293,".$soc->id.",'".$temporel."','0',".$user->id.")"; 452 453 if (! $db->query($sql) ) 454 { 455 $error++; 456 } 457 458 $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; 459 $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; 460 $sql .= " (1293,".$soc->id.",'".$temporel."','0',".$user->id.",now())"; 461 462 if (! $db->query($sql) ) 463 { 464 $error++; 465 } 466 467 if ( $error == 0 ) 468 { 469 $db->commit(); 470 } 471 else 472 { 473 $db->rollback(); 474 $mesg = "Erreur tarifs !"; 475 } 476 } 477 } 478 479 /* mobiles */ 480 if (strlen(trim($_POST["mobil"])) > 0 && $verif == "ok") 481 { 482 $mobil_ids = array(1289,1290,1291,1292); 483 foreach ($mobil_ids as $mobil_id) 484 { 485 $temporel = ereg_replace(",",".",trim($_POST["mobil"])); 486 487 if (!$error) 488 { 489 $db->begin(); 490 491 $sql = "REPLACE INTO ".MAIN_DB_PREFIX."telephonie_tarif_client"; 492 $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user) VALUES "; 493 $sql .= " (".$mobil_id.",".$soc->id.",'".$temporel."','0',".$user->id.")"; 494 495 if (! $db->query($sql) ) 496 { 497 $error++; 498 } 499 500 $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_tarif_client_log"; 501 $sql .= " (fk_tarif, fk_client, temporel, fixe, fk_user, datec) VALUES "; 502 $sql .= " (".$mobil_id.",".$soc->id.",'".$temporel."','0',".$user->id.",now())"; 503 504 if (! $db->query($sql) ) 505 { 506 $error++; 507 } 508 509 if ( $error == 0 ) 510 { 511 $db->commit(); 512 } 513 else 514 { 515 $db->rollback(); 516 $mesg = "Erreur tarifs !"; 517 } 518 } 519 } 520 } 521 522 /* FIN TARIFS */ 523 524 if (!$error && $verif == "ok") 525 { 526 Header("Location: ".DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id); 527 } 528 else 529 { 530 $mesg .= $error; 531 } 532 533 } 534 535 /** 536 * 537 * 538 */ 539 540 llxHeader(); 541 542 $form = new Form($db); 543 544 if ($user->rights->telephonie->ligne->creer) 545 { 546 547 dolibarr_fiche_head($head, $hselected, 'Nouveau client'); 548 /* 549 550 */ 551 552 if ($mesg) 553 { 554 print '<div class="error">'; 555 print $mesg; 556 print '</div>'; 557 } 558 else 559 { 560 561 } 562 563 $focus = " onfocus=\"this.className='focus';\" onblur=\"this.className='normal';\" "; 564 565 566 print '<FORM NAME="formClient" action="new.php" method="post">'; 567 print '<input type="hidden" name="codeclient_modifiable" value="1">'; 568 print '<input type="hidden" name="codefournisseur_modifiable" value="1">'; 569 print '<input type="hidden" name="action" value="add">'; 570 571 print '<div id="corpForm">'; 572 print '<fieldset id="societe">'; 573 print "<legend>Société</legend>\n"; 574 575 print '<table class="noborder" width="100%">'; 576 577 print '<tr><td width="20%">'.$langs->trans('Name').'</td><td>'; 578 print '<input type="text" size="30" name="nom" '; 579 print $focus .' value="'.$soc->nom.'"></td><td>'; 580 581 print "Attention ce formulaire n'est a utiliser uniquement pour les nouveaux clients.</td></tr>"; 582 583 // On positionne pays_id, pays_code et libelle du pays choisi 584 $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:(defined(MAIN_INFO_SOCIETE_PAYS)?MAIN_INFO_SOCIETE_PAYS:''); 585 if ($soc->pays_id) 586 { 587 $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$soc->pays_id; 588 $resql=$db->query($sql); 589 if ($resql) 590 { 591 $obj = $db->fetch_object($resql); 592 } 593 else 594 { 595 dolibarr_print_error($db); 596 } 597 $soc->pays_code=$obj->code; 598 $soc->pays=$obj->libelle; 599 } 600 601 print '<tr><td width="20%">'.$langs->trans('CustomerCode').'</td><td colspan="3">'; 602 603 print '<input size="7" type="text" name="code_client" maxlength="6"'; 604 print " onfocus=\"this.className='focus';\" onblur=\"this.className='normal';\" "; 605 print ' value="'.$soc->code_client.'">00</td>'; 606 607 print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea '.$focus.' name="adresse" cols="40" rows="2" wrap="soft">'; 608 print $soc->adresse; 609 print '</textarea></td></tr>'; 610 611 print '<tr><td>'.$langs->trans('Zip').'</td><td colspan="3">'; 612 print '<input size="7" maxlength="6" type="text" name="cp" '; 613 print " onfocus=\"this.className='focus';\" onblur=\"this.className='normal';\" "; 614 print ' value="'.$soc->cp.'"> '; 615 616 print $langs->trans('Town').' <input type="text" '.$focus.' name="ville" value="'.$soc->ville.'"></td></tr>'; 617 618 print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" size="11" maxlength="10" '.$focus.' name="tel" value="'.$soc->tel.'"></td>'; 619 print '<td>'.$langs->trans('Fax').'</td><td><input type="text" '.$focus.' name="fax" size="11" maxlength="10" value="'.$soc->fax.'"></td></tr>'; 620 621 print "</table>\n"; 622 print "</fieldset><br />\n"; 623 print '<fieldset id="contact">'; 624 print "<legend>Coordonnées bancaires</legend>\n"; 625 print '<table class="noborder" width="100%">'; 626 627 print '<tr><td width="20%">Titulaire du compte</td><td><input type="text" size="30" '.$focus.' name="titulaire" value="'.$_POST["titulaire"].'"></td></tr>'; 628 629 print '<tr><td width="20%">RIB</td><td colspan="3">'; 630 print '<input type="text" size="6" maxlength="5" '.$focus.' name="rib_banque" value="'.$_POST["rib_banque"].'">'; 631 print '<input type="text" size="6" maxlength="5" '.$focus.' name="rib_guichet" value="'.$_POST["rib_guichet"].'">'; 632 print '<input type="text" size="12" maxlength="11" '.$focus.' name="rib_compte" value="'.$_POST["rib_compte"].'">'; 633 print '<input type="text" size="3" maxlength="2" '.$focus.' name="rib_cle" value="'.$_POST["rib_cle"].'">'; 634 print ' IBAN '; 635 print '<input type="text" size="4" maxlength="4" '.$focus.' name="rib_iban" value="'.$_POST["rib_iban"].'">'; 636 print '</td></tr>'; 637 638 print '<tr><td width="20%">Règlement</td><td colspan="3">'; 639 print '<select name="mode_paiement">'; 640 if ($_POST["mode_paiement"] == 'vir') 641 { 642 print '<option value="pre">Prélèvement</option>'; 643 print '<option value="vir" SELECTED>Virement</option>'; 644 } 645 else 646 { 647 print '<option value="pre" SELECTED>Prélèvement</option>'; 648 print '<option value="vir">Virement</option>'; 649 } 650 print '</select>'; 651 print '</td></tr>'; 652 653 print "</table>\n"; 654 print "</fieldset><br />\n"; 655 656 print '<fieldset id="contact">'; 657 print "<legend>Contact</legend>\n"; 658 print '<table class="noborder" width="100%">'; 659 660 print '<tr><td width="20%">'.$langs->trans('Name').'</td><td><input type="text" size="30" '.$focus.' name="cnom" value="'.$contact->name.'"></td>'; 661 print '<td width="20%">'.$langs->trans('Firstname').'</td><td><input type="text" size="20" '.$focus.' name="cprenom" value="'.$contact->firstname.'"></td></tr>'; 662 print '<tr><td>'.$langs->trans('Mail').'</td><td><input type="text" size="40" '.$focus.' name="cmail" value="'.$contact->email.'"></td></tr>'; 663 664 print "</table>\n"; 665 print "</fieldset><br />\n"; 666 667 print '<fieldset id="contact">'; 668 print "<legend>Commercial</legend>\n"; 669 print '<table class="noborder" width="100%">'; 670 print '<tr><td width="20%">Commercial Signature</td><td >'; 671 $ff = array(); 672 $sql = "SELECT u.rowid, u.firstname, u.name"; 673 $sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."usergroup_user as ug"; 674 $sql .= " WHERE u.rowid = ug.fk_user"; 675 $sql .= " AND ug.fk_usergroup = '".TELEPHONIE_GROUPE_COMMERCIAUX_ID."'"; 676 $sql .= " ORDER BY name "; 677 if ( $db->query( $sql) ) 678 { 679 $num = $db->num_rows(); 680 if ( $num > 0 ) 681 { 682 while ($row = $db->fetch_row($resql)) 683 { 684 $ff[$row[0]] = $row[1] . " " . $row[2]; 685 } 686 } 687 $db->free(); 688 689 } 690 691 $form->select_array("commercial_sign",$ff,$ligne->commercial_sign); 692 693 print '</td>'; 694 695 print '<td width="20%">PO mensuelle</td><td valign="top" colspan="2">'; 696 print '<input '.$focus.' name="montantpo" size="8" value="'.$_POST["montantpo"].'"> euros HT</td></tr>'; 697 print '</td></tr>'; 698 699 print "</table>\n"; 700 print "</fieldset><br />\n"; 701 702 print '<fieldset id="ligne">'; 703 print "<legend>Lignes téléphoniques à présélectionner</legend>\n"; 704 705 print '<table class="noborder" width="100%">'; 706 707 print '<tr><td width="20%">Ligne téléphonique #1</td><td>0<input type="text" size="10" maxlength="9" '.$focus.' name="cli" value="'.$_POST["cli"].'"></td>'; 708 print '<td colspan="2">Si le client a plusieurs lignes vous pourrez les ajouter au contrat ultérieuremnt</td></tr>'; 709 710 print '<tr><td width="20%">Ligne téléphonique #2</td><td>0<input type="text" size="10" maxlength="9" '.$focus.' name="cli2" value="'.$_POST["cli2"].'"></td></tr>'; 711 712 print '<tr><td width="20%">Ligne téléphonique #3</td><td>0<input type="text" size="10" maxlength="9" '.$focus.' name="cli3" value="'.$_POST["cli3"].'"></td></tr>'; 713 714 print '<tr><td width="20%">Fournisseur</td><td>'; 715 $ff = array(); 716 $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; 717 $resql = $db->query($sql); 718 if ($resql) 719 { 720 while ($row = $db->fetch_row($resql)) 721 { 722 $ff[$row[0]] = $row[1]; 723 } 724 $db->free($resql); 725 } 726 727 $def =$ligne->fournisseur?$ligne->fournisseur:TELEPHONIE_FOURNISSEUR_DEFAUT_ID; 728 729 $form->select_array("fournisseur",$ff,$def); 730 print '</td>'; 731 732 print '<td width="20%">Fournisseur précédent</td><td>'; 733 $ff = array(); 734 $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_concurrents ORDER BY rowid "; 735 $resql = $db->query( $sql) ; 736 if ($resql) 737 { 738 $num = $db->num_rows($resql); 739 if ( $num > 0 ) 740 { 741 while ($row = $db->fetch_row($resql)) 742 { 743 $ff[$row[0]] = $row[1]; 744 } 745 } 746 $db->free(); 747 748 } 749 $form->select_array("concurrent",$ff,$ligne->concurrent); 750 print '</td></tr>'; 751 752 print "</table>\n"; 753 print "</fieldset><br />\n"; 754 755 /* DEBUT TARIFS */ 756 757 print '<fieldset id="ligne">'; 758 print "<legend>Tarifs</legend>\n"; 759 if ($user->rights->telephonie->tarif->client_modifier) 760 { 761 print '<table class="noborder" width="100%">'; 762 763 print '<tr><td width="20%">France</td><td><input type="text" size="10" maxlength="9" '.$focus.' name="france" value="'.$_POST["france"].'"></td><td>Laissez vide si tarifs par défaut</tr>'; 764 765 print '<tr><td width="20%">Mobiles</td><td><input type="text" size="10" maxlength="9" '.$focus.' name="mobil" value="'.$_POST["mobil"].'"></td><td>Tous réseaux confondus</td></tr>'; 766 767 print "</table>\n"; 768 } 769 else 770 { 771 print "Vous n'avez pas les droits pour modifier les tarifs"; 772 } 773 print "</fieldset><br />\n"; 774 775 /* FIN TARIFS */ 776 777 print '<input type="submit" value="'.$langs->trans('Save').'">'."\n"; 778 779 print '</form>'."\n"; 780 print "</div>\n"; 781 } 782 783 784 $db->close(); 785 786 787 llxFooter('$Date: 2005/12/07 11:29:21 $ - $Revision: 1.8 $'); 788 ?> 789
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 |
|