diff --git a/htdocs/telephonie/ligne/fiche.php b/htdocs/telephonie/ligne/fiche.php index d538fdee91f..8d5509215b8 100644 --- a/htdocs/telephonie/ligne/fiche.php +++ b/htdocs/telephonie/ligne/fiche.php @@ -80,7 +80,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') } } -if ($_POST["action"] == 'updateremise') +if ($_POST["action"] == 'updateremise' && $user->rights->telephonie->ligne->creer) { $ligne = new LigneTel($db); $ligne->id = $_GET["id"]; @@ -95,6 +95,17 @@ if ($_POST["action"] == 'updateremise') } } +if ($_POST["action"] == 'changecontrat' && $user->rights->telephonie->ligne->creer) +{ + $ligne = new LigneTel($db); + $ligne->id = $_GET["id"]; + + if ( $ligne->ChangeContrat($user, $_POST["contrat"]) == 0) + { + Header("Location: fiche.php?id=".$ligne->id); + } +} + if ($_POST["action"] == 'addcontact') { $ligne = new LigneTel($db); @@ -687,7 +698,7 @@ else $i++; } } - $db->free(); + $db->free(); } else @@ -705,7 +716,7 @@ else print "
"; - if ($_GET["action"] == "editremise" && $ligne->statut <> 6) + if ($_GET["action"] == "editremise" && $ligne->statut <> 6 && $user->rights->telephonie->ligne->creer) { /** * Edition de la remise @@ -728,6 +739,53 @@ else print ''; } + if ($_GET["action"] == "chgcontrat" && $user->rights->telephonie->ligne->creer) + { + /** + * Edition de la remise + */ + + print '
'; + print ''; + print ''; + print ''; + print ''; + + print ''; + + print '
Migrer vers un autre contrat
Nouveau contrat'; + print '

'; + + print '
'; + } + } @@ -1163,6 +1221,11 @@ if ($_GET["action"] == '') print "id\">".$langs->trans("Contact").""; } + if ( $user->rights->telephonie->ligne->creer && $ligne->statut < 4) + { + print "id\">".$langs->trans("Changer de contrat").""; + } + if ( $user->rights->telephonie->ligne->creer && $ligne->statut < 4) { print "id\">".$langs->trans("Changer la remise").""; diff --git a/htdocs/telephonie/lignetel.class.php b/htdocs/telephonie/lignetel.class.php index fb8f3e30e59..f7de1d790be 100644 --- a/htdocs/telephonie/lignetel.class.php +++ b/htdocs/telephonie/lignetel.class.php @@ -704,5 +704,17 @@ class LigneTel { return -2; } } + + function ChangeContrat($user, $contrat_id) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; + $sql .= " SET fk_contrat = ".$contrat_id ; + $sql .= " WHERE rowid = ".$this->id; + + $resql = $this->db->query($sql); + + return 0; + } + } ?>