Modif permissions

This commit is contained in:
Rodolphe Quiedeville 2005-09-02 09:56:24 +00:00
parent 35e4f573ac
commit 65874a977e
4 changed files with 124 additions and 93 deletions

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -26,24 +26,32 @@ $mesg = '';
llxHeader("","","Fiche Ligne"); llxHeader("","","Fiche Ligne");
if ($_GET["id"] or $_GET["numero"]) if ($_GET["id"] or $_GET["numero"])
{ {
if ($_GET["action"] <> 're-edit')
$ligne = new LigneTel($db);
if ($_GET["id"])
{ {
$ligne = new LigneTel($db); $result = $ligne->fetch_by_id($_GET["id"]);
if ($_GET["id"]) }
{ if ($_GET["numero"])
$result = $ligne->fetch_by_id($_GET["id"]); {
} $result = $ligne->fetch($_GET["numero"]);
if ($_GET["numero"])
{
$result = $ligne->fetch($_GET["numero"]);
}
} }
if ( $result ) if ($result == 1)
{
$client_comm = new Societe($db);
$client_comm->fetch($ligne->client_comm_id, $user);
}
if (!$client_comm->perm_read)
{
print "Lecture non authorisée";
}
if ($result == 1 && $client_comm->perm_read)
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{ {
@ -128,7 +136,7 @@ if ($_GET["id"] or $_GET["numero"])
} }
else else
{ {
print $sql; //print $sql;
} }
print '<tr><td colspan="2" align="center">'; print '<tr><td colspan="2" align="center">';

View File

@ -26,10 +26,6 @@ $mesg = '';
llxHeader("","","Historique Ligne"); llxHeader("","","Historique Ligne");
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
/* /*
* Affichage * Affichage
* *
@ -50,7 +46,20 @@ if ($cancel == $langs->trans("Cancel"))
} }
} }
if ( $result )
if ($result == 1)
{
$client_comm = new Societe($db);
$client_comm->fetch($ligne->client_comm_id, $user);
}
if (!$client_comm->perm_read)
{
print "Lecture non authorisée";
}
if ($result == 1 && $client_comm->perm_read)
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{ {
@ -92,9 +101,6 @@ if ($cancel == $langs->trans("Cancel"))
$client = new Societe($db, $ligne->client_id); $client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id); $client->fetch($ligne->client_id);
$client_comm = new Societe($db, $ligne->client_comm_id);
$client_comm->fetch($ligne->client_comm_id);
print '<tr><td width="20%">Client</td><td colspan="3">'; print '<tr><td width="20%">Client</td><td colspan="3">';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">'; print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">';
print $client_comm->nom.'</a></td></tr>'; print $client_comm->nom.'</a></td></tr>';
@ -160,15 +166,16 @@ if ($cancel == $langs->trans("Cancel"))
$sql .= ",".MAIN_DB_PREFIX."user as u"; $sql .= ",".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id; $sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id;
$sql .= " ORDER BY l.tms DESC "; $sql .= " ORDER BY l.tms DESC ";
if ( $db->query( $sql) ) $resql = $db->query($sql);
if ($resql)
{ {
$num = $db->num_rows(); $num = $db->num_rows($resql);
if ( $num > 0 ) if ( $num > 0 )
{ {
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_row($i); $row = $db->fetch_row($resql);
print '<tr><td valign="top" width="20%">'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).'</td>'; print '<tr><td valign="top" width="20%">'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).'</td>';
print '<td><img src="./graph'.$row[1].'.png">&nbsp;'; print '<td><img src="./graph'.$row[1].'.png">&nbsp;';
@ -179,14 +186,12 @@ if ($cancel == $langs->trans("Cancel"))
} }
print '</td><td>'; print '</td><td>';
print $ff[$row[6]]; print $ff[$row[6]];
print '</td><td>'.$row[4] . " " . $row[3] . "</td></tr>"; print '</td><td>'.$row[4] . " " . $row[3] . "</td></tr>";
$i++; $i++;
} }
} }
$db->free(); $db->free($resql);
} }
else else
{ {
@ -195,64 +200,60 @@ if ($cancel == $langs->trans("Cancel"))
print "</table>"; print "</table>";
} }
}
/* /*
* *
*/ */
print '<br />'; print '<br />';
print_titre("Retours Fournisseurs"); print_titre("Retours Fournisseurs");
$sql = "SELECT "; $sql = "SELECT ";
$sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite "; $sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite ";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour";
$sql .= " WHERE cli = ".$ligne->numero;
$sql .= " ORDER BY rowid DESC " . $db->plimit($conf->liste_limit+1, $offset);
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour";
print '<tr class="liste_titre"><td>Mode</td><td>Resultat</td>'; $sql .= " WHERE cli = ".$ligne->numero;
print '<td align="center">Date MeS</td><td>Résil</td></td><td>Commentaire</td><td>Fichier</td>'; $sql .= " ORDER BY rowid DESC " . $db->plimit($conf->liste_limit+1, $offset);
print "</tr>\n";
$var=True;
while ($i < $num) $resql = $db->query($sql);
if ($resql)
{ {
$obj = $db->fetch_object(); print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
$var=!$var; print '<tr class="liste_titre"><td>Mode</td><td>Resultat</td>';
print '<td align="center">Date MeS</td><td>Résil</td></td><td>Commentaire</td><td>Fichier</td>';
print "<tr $bc[$var]>";
print '<td>'.$obj->mode."</td>\n";
print '<td>'.$obj->situation."</td>\n";
print '<td align="center">'.$obj->date_mise_service."</td>\n";
print '<td align="center">'.$obj->date_resiliation."</td>\n";
print '<td>'.$obj->commentaire."</td>\n";
print '<td>'.$obj->fichier."</td>\n";
print "</tr>\n"; print "</tr>\n";
$var=True;
$i++;
while ($obj = $db->fetch_object($resql))
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td>'.$obj->mode."</td>\n";
print '<td>'.$obj->situation."</td>\n";
print '<td align="center">'.$obj->date_mise_service."</td>\n";
print '<td align="center">'.$obj->date_resiliation."</td>\n";
print '<td>'.$obj->commentaire."</td>\n";
print '<td>'.$obj->fichier."</td>\n";
print "</tr>\n";
}
print "</table>";
$db->free($resql);
} }
print "</table>"; else
$db->free(); {
print $db->error() . ' ' . $sql;
}
/*
*
*
*
*/
} }
else
{
print $db->error() . ' ' . $sql;
}
/*
*
*
*
*/
}
else
{
print "Error";
} }
else
{
print "Error";
}
$db->close(); $db->close();

View File

@ -30,7 +30,7 @@ require("./pre.inc.php");
$mesg = ''; $mesg = '';
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 = new LigneTel($db);
$ligne->id = $_GET["id"]; $ligne->id = $_GET["id"];
@ -79,7 +79,19 @@ if ($_GET["id"] or $_GET["numero"])
} }
} }
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 "Lecture non authorisée";
}
if ($result == 1 && $client_comm->perm_read)
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{ {

View File

@ -26,20 +26,30 @@ llxHeader("","","Fiche Ligne");
if ($_GET["id"] or $_GET["numero"]) if ($_GET["id"] or $_GET["numero"])
{ {
if ($_GET["action"] <> 're-edit') $ligne = new LigneTel($db);
if ($_GET["id"])
{ {
$ligne = new LigneTel($db); $result = $ligne->fetch_by_id($_GET["id"]);
if ($_GET["id"]) }
{ if ($_GET["numero"])
$result = $ligne->fetch_by_id($_GET["id"]); {
} $result = $ligne->fetch($_GET["numero"]);
if ($_GET["numero"])
{
$result = $ligne->fetch($_GET["numero"]);
}
} }
if ( $result )
if ($result == 1)
{
$client_comm = new Societe($db);
$client_comm->fetch($ligne->client_comm_id, $user);
}
if (!$client_comm->perm_read)
{
print "Lecture non authorisée";
}
if ($result == 1 && $client_comm->perm_read)
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{ {