From 6e0a4e282033612fb42eb993547f8f6100acba5b Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 7 Sep 2005 08:05:30 +0000 Subject: [PATCH] Modif permissions --- htdocs/telephonie/contrat/services.php | 168 +++++++++++++------------ 1 file changed, 85 insertions(+), 83 deletions(-) diff --git a/htdocs/telephonie/contrat/services.php b/htdocs/telephonie/contrat/services.php index 7c7b09a3606..dcf26fbfd52 100644 --- a/htdocs/telephonie/contrat/services.php +++ b/htdocs/telephonie/contrat/services.php @@ -24,7 +24,7 @@ require "./pre.inc.php"; $mesg = ''; -if ($_POST["action"] == 'addservice') +if ($_POST["action"] == 'addservice' && $user->rights->telephonie->ligne->creer) { $contrat = new TelephonieContrat($db); $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->id= $_GET["id"]; @@ -48,93 +48,92 @@ if ($_GET["action"] == 'rmservice') llxHeader("","","Fiche Contrat - Services"); -if ($cancel == $langs->trans("Cancel")) + +if ($_GET["id"]) { - $action = ''; -} - - - if ($_GET["id"]) + $client_comm = new Societe($db); + $contrat = new TelephonieContrat($db); + + if ($contrat->fetch($_GET["id"]) > 0) { - if ($_GET["action"] <> 're-edit') + $result = 1; + $client_comm->fetch($contrat->client_comm_id, $user); + } + else + { + print "Erreur"; + } + + if (!$client_comm->perm_read) + { + print "Lecture non authorisée"; + } + + if ( $result && $client_comm->perm_read) + { + if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') { - $contrat = new TelephonieContrat($db); - - if ($contrat->fetch($_GET["id"]) == 0) + + $h=0; + $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; + $head[$h][1] = $langs->trans("Contrat"); + $h++; + + $nser = $contrat->count_associated_services(); + + $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; + if ($nser > 0) { - $result = 1; + $head[$h][1] = $langs->trans("Services")." (".$nser.")"; } - } - - if ( $result ) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') + else { - - $h=0; - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Contrat"); - $h++; - - $nser = $contrat->count_associated_services(); - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id; - if ($nser > 0) - { - $head[$h][1] = $langs->trans("Services")." (".$nser.")"; - } - else - { - $head[$h][1] = $langs->trans("Services"); - } - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Stats"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id; - $head[$h][1] = $langs->trans("Infos"); - $h++; - - dolibarr_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); - - print_fiche_titre('Fiche Contrat', $mesg); - - print ''; - - $client_comm = new Societe($db, $contrat->client_comm_id); - $client_comm->fetch($contrat->client_comm_id); - - print ''; - print ''; - - print '
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; - print ''; - - print $client_comm->nom.''.$client_comm->code_client; + $head[$h][1] = $langs->trans("Services"); + } + $hselected = $h; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id; + $head[$h][1] = $langs->trans("Stats"); + $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id; + $head[$h][1] = $langs->trans("Infos"); + $h++; + + dolibarr_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref); + + print_fiche_titre('Fiche Contrat', $mesg); + + print ''; + print ''; + print ''; + + print ''; + + if ($contrat->client_comm_id <> $contrat->client_id) + { + $client = new Societe($db, $contrat->client_id); + $client->fetch($contrat->client_id); + print ''; - - if ($contrat->client_comm_id <> $contrat->client_id) - { - $client = new Societe($db, $contrat->client_id); - $client->fetch($contrat->client_id); - print ''; - } - - $commercial = new User($db, $contrat->commercial_sign_id); - $commercial->fetch(); - - print ''; - print ''; - - $commercial_suiv = new User($db, $contrat->commercial_suiv_id); - $commercial_suiv->fetch(); - + } + + $commercial = new User($db, $contrat->commercial_sign_id); + $commercial->fetch(); + + print ''; + print ''; + + $commercial_suiv = new User($db, $contrat->commercial_suiv_id); + $commercial_suiv->fetch(); + print ''; print ''; @@ -249,6 +248,9 @@ if ($cancel == $langs->trans("Cancel")) * */ + if ($user->rights->telephonie->ligne->creer) + { + print_fiche_titre('Ajouter un service', $mesg); print ''; @@ -294,7 +296,7 @@ if ($cancel == $langs->trans("Cancel")) print ''; print '
Référence'.$contrat->ref.'Facturé : '.$contrat->facturable.'
Client'; + print ''; + + print $client_comm->nom.''.$client_comm->code_client; + print '
Client (Agence/Filiale)'; + print $client->nom.'
'; + print $client->cp . " " .$client->ville; print '
Client (Agence/Filiale)'; - print $client->nom.'
'; - print $client->cp . " " .$client->ville; - print '
Commercial Signature'.$commercial->fullname.'
Commercial Signature'.$commercial->fullname.'
Commercial Suivi'.$commercial_suiv->fullname.'
'; print ''; - + } /* * *