diff --git a/htdocs/telephonie/ligne/fiche.php b/htdocs/telephonie/ligne/fiche.php index e33aee8366f..e445216793e 100644 --- a/htdocs/telephonie/ligne/fiche.php +++ b/htdocs/telephonie/ligne/fiche.php @@ -34,28 +34,45 @@ $s = strftime("%S",$dt); if ($_POST["action"] == 'add' && $user->rights->telephonie->ligne->creer) { - $ligne = new LigneTel($db); - $ligne->contrat = $_POST["contrat"]; - $ligne->numero = $_POST["numero"]; - $ligne->client_comm = $_POST["client_comm"]; - $ligne->client = $_POST["client"]; - $ligne->client_facture = $_POST["client_facture"]; - $ligne->fournisseur = $_POST["fournisseur"]; - $ligne->commercial_sign = $_POST["commercial_sign"]; - $ligne->commercial_suiv = $_POST["commercial_suiv"]; - $ligne->concurrent = $_POST["concurrent"]; - $ligne->remise = $_POST["remise"]; - $ligne->note = $_POST["note"]; - $ligne->techno = $_POST["techno"]; + $result = 0; + + $cbegin = trim($_POST["numero"]); + $cend = strlen(trim($_POST["numero_end"]))>0?trim($_POST["numero_end"]):trim($_POST["numero"]); - if ( $ligne->create($user) == 0) + $cli = $cbegin; + + while ($cli <= $cend) + { + $ligne = new LigneTel($db); + $ligne->contrat = $_POST["contrat"]; + $ligne->numero = "0".$cli; + $ligne->client_comm = $_POST["client_comm"]; + $ligne->client = $_POST["client"]; + $ligne->client_facture = $_POST["client_facture"]; + $ligne->fournisseur = $_POST["fournisseur"]; + $ligne->commercial_sign = $_POST["commercial_sign"]; + $ligne->commercial_suiv = $_POST["commercial_suiv"]; + $ligne->concurrent = $_POST["concurrent"]; + $ligne->remise = $_POST["remise"]; + $ligne->note = $_POST["note"]; + $ligne->techno = $_POST["techno"]; + + $result += $ligne->create($user); + + $cli++; + } + + if ( $result == 0) { - Header("Location: fiche.php?id=".$ligne->id); + Header("Location: ../contrat/fiche.php?id=".$ligne->contrat); } else { $_GET["action"] = 'create'; $_GET["contratid"] = $_POST["contrat"]; + + $ligne->numero = $_POST["numero"]; + $ligne->numero_end = $_POST["numero_end"]; } } @@ -310,7 +327,7 @@ elseif ($_GET["action"] == 'create' && $_GET["contratid"] > 0) $form = new Form($db); - print_titre("Nouvelle ligne sur le contrat : ".$contrat->ref); + print_titre("Nouvelle(s) ligne(s) sur le contrat : ".$contrat->ref); if (is_object($ligne)) { @@ -365,19 +382,15 @@ elseif ($_GET["action"] == 'create' && $_GET["contratid"] > 0) print '
| Contrat | '.$contrat->ref_url.' | |
| Contrat | '.$contrat->ref_url.' | |
| Client | '; - print $socc->nom; - print ' | |
| Code client | '; - print $socc->code_client; - print ' | |
| Numéro | ||
| Client | '.$socc->nom.' | |
| Code client | '.$socc->code_client.' | |
| Numéro | 0 | '; + print '0 derniere SDA | '; print ''; - print ' |
| Fournisseur | '; + print ' | |
| Fournisseur | '; $ff = array(); $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; if ( $db->query( $sql) ) @@ -422,7 +435,7 @@ elseif ($_GET["action"] == 'create' && $_GET["contratid"] > 0) $tech = array(); $tech["presel"] = "Présélection"; $tech["voip"] = "VoIP"; - print " Technologie : "; + print " | Technologie : "; $form->select_array("techno",$tech,"presel"); print ' |
| Fournisseur précédent | '; + print ' | |
| Fournisseur précédent | '; $ff = array(); $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_concurrents ORDER BY rowid "; if ( $db->query( $sql) ) @@ -455,17 +468,15 @@ elseif ($_GET["action"] == 'create' && $_GET["contratid"] > 0) print ' | |
| Remise LMN | % | |
| Note | '."\n"; + print ' | |
| Note | '."\n"; print ' | |