diff --git a/htdocs/telephonie/client/new.php b/htdocs/telephonie/client/new.php index 90274924a02..d42cdcb7779 100644 --- a/htdocs/telephonie/client/new.php +++ b/htdocs/telephonie/client/new.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2003 Brian Fraval * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2005 Eric Seigne @@ -155,6 +155,12 @@ if ($_POST["action"] == 'add') $verif = "nok"; } + if (strlen(trim($_POST["cliend"])) <> 9 && $verif == 'ok') + { + $mesg = "Numéro de ligne dernier SDA (0".$_POST["cliend"].") incorrect"; + $verif = "nok"; + } + $p = array("1","2","3","4","5"); if (!in_array(substr(trim($_POST["cli"]),0,1), $p) && $verif == 'ok') @@ -367,6 +373,8 @@ if ($_POST["action"] == 'add') $contrat->addpo($_POST["montantpo"], $user); } + /* Ligne 1 */ + $ligne = new LigneTel($db); $ligne->contrat = $contrat->id; $ligne->numero = "0".$_POST["cli"]; @@ -397,6 +405,47 @@ if ($_POST["action"] == 'add') } } + /* SDA */ + + if(!$error && $verif == "ok") + { + if (strlen(trim($_POST["cli"])) == 9 && strlen(trim($_POST["cliend"])) == 9) + { + $cbegin = trim($_POST["cli"]) + 1; + $cend = trim($_POST["cliend"]); + + $cli = $cbegin; + + while ($cli <= $cend) + { + $ligne = new LigneTel($db); + $ligne->contrat = $contrat->id; + $ligne->numero = "0".$cli; + $ligne->client_comm = $soc->id; + $ligne->client = $soc->id; + $ligne->client_facture = $soc->id; + $ligne->fournisseur = $_POST["fournisseur"]; + $ligne->commercial_sign = $_POST["commercial_sign"]; + $ligne->commercial_suiv = $_POST["commercial_sign"]; + $ligne->concurrent = $_POST["concurrent"]; + $ligne->remise = "0"; + $ligne->note = $_POST["note"]; + + if ( $ligne->create($user, $_POST["mode_paiement"]) == 0) + { + + } + else + { + $error = 1027; + $mesg.= "Impossible de créer la ligne 0$cli"; + } + + $cli++; + } + } + } + /* Ligne 2 */ $ligne = new LigneTel($db); @@ -730,7 +779,10 @@ if ($user->rights->telephonie->ligne->creer) print ''; print ''; - print ''; + + print ''; + + print '';
Ligne téléphonique #10Si le client a plusieurs lignes vous pourrez les ajouter au contrat ultérieuremnt
Derniere SDA0
Ligne téléphonique #20