Modif permissions

This commit is contained in:
Rodolphe Quiedeville 2005-09-07 08:05:30 +00:00
parent e7b1d6752e
commit 6e0a4e2820

View File

@ -24,7 +24,7 @@ require "./pre.inc.php";
$mesg = ''; $mesg = '';
if ($_POST["action"] == 'addservice') if ($_POST["action"] == 'addservice' && $user->rights->telephonie->ligne->creer)
{ {
$contrat = new TelephonieContrat($db); $contrat = new TelephonieContrat($db);
$contrat->id= $_GET["id"]; $contrat->id= $_GET["id"];
@ -35,7 +35,7 @@ if ($_POST["action"] == 'addservice')
} }
} }
if ($_GET["action"] == 'rmservice') if ($_GET["action"] == 'rmservice' && $user->rights->telephonie->ligne->creer)
{ {
$contrat = new TelephonieContrat($db); $contrat = new TelephonieContrat($db);
$contrat->id= $_GET["id"]; $contrat->id= $_GET["id"];
@ -48,25 +48,28 @@ if ($_GET["action"] == 'rmservice')
llxHeader("","","Fiche Contrat - Services"); llxHeader("","","Fiche Contrat - Services");
if ($cancel == $langs->trans("Cancel"))
if ($_GET["id"])
{ {
$action = ''; $client_comm = new Societe($db);
}
if ($_GET["id"])
{
if ($_GET["action"] <> 're-edit')
{
$contrat = new TelephonieContrat($db); $contrat = new TelephonieContrat($db);
if ($contrat->fetch($_GET["id"]) == 0) if ($contrat->fetch($_GET["id"]) > 0)
{ {
$result = 1; $result = 1;
$client_comm->fetch($contrat->client_comm_id, $user);
} }
else
{
print "Erreur";
} }
if ( $result ) if (!$client_comm->perm_read)
{
print "Lecture non authorisée";
}
if ( $result && $client_comm->perm_read)
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{ {
@ -103,10 +106,6 @@ if ($cancel == $langs->trans("Cancel"))
print_fiche_titre('Fiche Contrat', $mesg); print_fiche_titre('Fiche Contrat', $mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
$client_comm = new Societe($db, $contrat->client_comm_id);
$client_comm->fetch($contrat->client_comm_id);
print '<tr><td width="20%">Référence</td><td>'.$contrat->ref.'</td>'; print '<tr><td width="20%">Référence</td><td>'.$contrat->ref.'</td>';
print '<td>Facturé : '.$contrat->facturable.'</td></tr>'; print '<td>Facturé : '.$contrat->facturable.'</td></tr>';
@ -249,6 +248,9 @@ if ($cancel == $langs->trans("Cancel"))
* *
*/ */
if ($user->rights->telephonie->ligne->creer)
{
print_fiche_titre('Ajouter un service', $mesg); print_fiche_titre('Ajouter un service', $mesg);
print '<form action="services.php?id='.$contrat->id.'" method="post">'; print '<form action="services.php?id='.$contrat->id.'" method="post">';
@ -294,7 +296,7 @@ if ($cancel == $langs->trans("Cancel"))
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
}
/* /*
* *
* *