diff --git a/htdocs/telephonie/contrat/fiche.php b/htdocs/telephonie/contrat/fiche.php
index 45630848dbc..e844cdae17c 100644
--- a/htdocs/telephonie/contrat/fiche.php
+++ b/htdocs/telephonie/contrat/fiche.php
@@ -25,7 +25,7 @@ require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
$mesg = '';
-if ($_POST["action"] == 'add')
+if ($_POST["action"] == 'add' && $user->rights->telephonie->ligne->creer)
{
$contrat = new TelephonieContrat($db);
@@ -46,7 +46,7 @@ if ($_POST["action"] == 'add')
}
-if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
+if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->telephonie->ligne->creer)
{
$contrat = new TelephonieContrat($db);
$contrat->id = $_GET["id"];
@@ -74,7 +74,7 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
}
}
-if ($_POST["action"] == 'addcontact')
+if ($_POST["action"] == 'addcontact' && $user->rights->telephonie->ligne->creer)
{
$contrat = new TelephonieContrat($db);
$contrat->id = $_GET["id"];
@@ -95,7 +95,7 @@ if ($_POST["action"] == 'addpo' && $user->rights->telephonie->ligne->creer)
}
-if ($_GET["action"] == 'delcontact')
+if ($_GET["action"] == 'delcontact' && $user->rights->telephonie->ligne->creer)
{
$contrat = new TelephonieContrat($db);
$contrat->id = $_GET["id"];
@@ -128,7 +128,7 @@ if ($cancel == $langs->trans("Cancel"))
* Création en 2 étape
*
*/
-if ($_GET["action"] == 'create')
+if ($_GET["action"] == 'create' && $user->rights->telephonie->ligne->creer)
{
$form = new Form($db);
print_titre("Nouveau contrat");
@@ -174,7 +174,7 @@ if ($_GET["action"] == 'create')
print ''."\n";
print '';
}
-elseif ($_GET["action"] == 'create_line' && $_GET["client_comm"] > 0)
+elseif ($_GET["action"] == 'create_line' && $_GET["client_comm"] > 0 && $user->rights->telephonie->ligne->creer)
{
$form = new Form($db);
print_titre("Nouveau contrat");
@@ -190,8 +190,9 @@ elseif ($_GET["action"] == 'create_line' && $_GET["client_comm"] > 0)
}
$socc = new Societe($db);
+ $socc->fetch($_GET["client_comm"]);
- if ( $socc->fetch($_GET["client_comm"]) == 1)
+ if ( $socc->id > 0)
{
if (strlen($socc->code_client) == 0)
@@ -409,7 +410,18 @@ else
}
}
- if ( $result )
+ if ($result == 1)
+ {
+ $client_comm = new Societe($db);
+ $client_comm->fetch($contrat->client_comm_id, $user);
+ }
+
+ if (!$client_comm->perm_read)
+ {
+ print "Lecture non authorisée";
+ }
+
+ if ( $result && $client_comm->perm_read)
{
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
@@ -447,7 +459,7 @@ else
print '
';
- $client_comm = new Societe($db, $contrat->client_comm_id);
+ $client_comm = new Societe($db);
$client_comm->fetch($contrat->client_comm_id);
print '| Référence | '.$contrat->ref.' | ';
@@ -946,6 +958,44 @@ else
print '';
+
+ /* ************************************************************************** */
+ /* */
+ /* Barre d'action */
+ /* */
+ /* ************************************************************************** */
+
+ print "\n
\n";
}
}
else
@@ -954,43 +1004,6 @@ else
}
}
-/* ************************************************************************** */
-/* */
-/* Barre d'action */
-/* */
-/* ************************************************************************** */
-
-print "\n
\n";
diff --git a/htdocs/telephonie/ligne/fiche.php b/htdocs/telephonie/ligne/fiche.php
index dd6bca2623a..fc1a6724ee7 100644
--- a/htdocs/telephonie/ligne/fiche.php
+++ b/htdocs/telephonie/ligne/fiche.php
@@ -32,7 +32,7 @@ $h = strftime("%H",$dt);
$m = strftime("%M",$dt);
$s = strftime("%S",$dt);
-if ($_POST["action"] == 'add')
+if ($_POST["action"] == 'add' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->contrat = $_POST["contrat"];
@@ -58,7 +58,7 @@ if ($_POST["action"] == 'add')
}
}
-if ($_GET["action"] == 'transfer')
+if ($_GET["action"] == 'transfer' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -69,7 +69,7 @@ if ($_GET["action"] == 'transfer')
}
}
-if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
+if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -106,7 +106,7 @@ if ($_POST["action"] == 'changecontrat' && $user->rights->telephonie->ligne->cre
}
}
-if ($_POST["action"] == 'addcontact')
+if ($_POST["action"] == 'addcontact' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
@@ -119,7 +119,7 @@ if ($_POST["action"] == 'addcontact')
}
-if ($_GET["action"] == 'delcontact')
+if ($_GET["action"] == 'delcontact' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
@@ -131,7 +131,7 @@ if ($_GET["action"] == 'delcontact')
}
-if ($_GET["action"] == 'active')
+if ($_GET["action"] == 'active' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -148,7 +148,7 @@ if ($_GET["action"] == 'active')
}
-if ($_GET["action"] == 'refuse')
+if ($_GET["action"] == 'refuse' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -164,7 +164,7 @@ if ($_GET["action"] == 'refuse')
}
}
-if ($_GET["action"] == 'resilier')
+if ($_GET["action"] == 'resilier' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -175,7 +175,7 @@ if ($_GET["action"] == 'resilier')
}
}
-if ($_GET["action"] == 'annuleresilier')
+if ($_GET["action"] == 'annuleresilier' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -186,7 +186,7 @@ if ($_GET["action"] == 'annuleresilier')
}
}
-if ($_GET["action"] == 'confirmresilier')
+if ($_GET["action"] == 'confirmresilier' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -232,7 +232,7 @@ if ($_GET["action"] == 'confirmresilier')
}
}
-if ($_GET["action"] == 'acommander')
+if ($_GET["action"] == 'acommander' && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
@@ -244,7 +244,7 @@ if ($_GET["action"] == 'acommander')
}
-if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
+if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->telephonie->ligne->creer)
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
@@ -511,7 +511,20 @@ else
}
}
- if ( $result == 1)
+ if ($result == 1)
+ {
+ $client_comm = new Societe($db);
+ $client_comm->fetch($ligne->client_comm_id, $user);
+ }
+
+ if (!$client_comm->perm_read)
+ {
+ print decoct($client_comm->id);
+ print "Lecture non authorisée";
+ }
+
+
+ if ($result == 1 && $client_comm->perm_read)
{
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
@@ -583,9 +596,6 @@ else
print '
';
}
- $client_comm = new Societe($db, $ligne->client_comm_id);
- $client_comm->fetch($ligne->client_comm_id);
-
print '| Client | ';
print '';
@@ -1295,7 +1305,7 @@ if ( $user->rights->telephonie->ligne->creer && $ligne->statut == 6)
print "\n \n\n";
-if ($_GET["action"] == '')
+if ($_GET["action"] == '' && $result == 1 && $client_comm->perm_read)
{
if ( $user->rights->telephonie->ligne->resilier && $ligne->statut == 3)
|