diff --git a/htdocs/telephonie/ligne/fiche.php b/htdocs/telephonie/ligne/fiche.php index 33d0f593a14..704040da9af 100644 --- a/htdocs/telephonie/ligne/fiche.php +++ b/htdocs/telephonie/ligne/fiche.php @@ -58,6 +58,17 @@ if ($_POST["action"] == 'add') } } +if ($_GET["action"] == 'transfer') +{ + $ligne = new LigneTel($db); + $ligne->fetch_by_id($_GET["id"]); + + if ( $ligne->transfer($user,$_POST["fournisseur"]) == 0) + { + Header("Location: fiche.php?id=".$ligne->id); + } +} + if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') { $ligne = new LigneTel($db); @@ -1001,6 +1012,51 @@ else } } +if ( $user->rights->telephonie->ligne_commander && $ligne->statut == 3 ) +{ + $ff = array(); + $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom "; + if ( $db->query( $sql) ) + { + $num = $db->num_rows(); + if ( $num > 0 ) + { + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row(); + if ($row[0] <> $ligne->fournisseur_id) + { + $ff[$row[0]] = $row[1]; + } + $i++; + } + } + $db->free(); + } + + if (sizeof($ff) > 0) + { + /** + * Transférer chez un autre fournisseur + */ + $form = new Form($db); + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + + print ''; + print '
Commander la ligne chez un autre fournisseur
Fournisseur'; + $form->select_array("fournisseur",$ff,$ligne->fournisseur); + print '
'; + print '
'; + print ' 
'; + } +} + if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 2)