Ajout sécurité accés extérieur
This commit is contained in:
parent
deb542f6a6
commit
35c731dab6
@ -1,5 +1,5 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
@ -22,11 +22,24 @@
|
|||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sécurité accés client
|
||||||
|
*/
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
if ($sortorder == "") {
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
$sortorder="ASC";
|
$sortorder="ASC";
|
||||||
}
|
}
|
||||||
if ($sortfield == "") {
|
if ($sortfield == "")
|
||||||
|
{
|
||||||
$sortfield="p.name";
|
$sortfield="p.name";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,41 +22,59 @@
|
|||||||
require("./pre.inc.php3");
|
require("./pre.inc.php3");
|
||||||
require("../../contact.class.php3");
|
require("../../contact.class.php3");
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sécurité accés client
|
||||||
|
*/
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
|
|
||||||
if ($action == 'note') {
|
if ($action == 'note')
|
||||||
|
{
|
||||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'stcomm') {
|
if ($action == 'stcomm')
|
||||||
if ($stcommid <> 'null' && $stcommid <> $oldstcomm) {
|
{
|
||||||
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
if ($stcommid <> 'null' && $stcommid <> $oldstcomm)
|
||||||
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
|
{
|
||||||
$result = @$db->query($sql);
|
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
||||||
|
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
|
||||||
|
$result = @$db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result)
|
||||||
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
{
|
||||||
$result = $db->query($sql);
|
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||||
} else {
|
$result = $db->query($sql);
|
||||||
$errmesg = "ERREUR DE DATE !";
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errmesg = "ERREUR DE DATE !";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($actioncommid) {
|
if ($actioncommid)
|
||||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
|
{
|
||||||
$result = @$db->query($sql);
|
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
|
||||||
|
$result = @$db->query($sql);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result)
|
||||||
$errmesg = "ERREUR DE DATE !";
|
{
|
||||||
|
$errmesg = "ERREUR DE DATE !";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
$fac = new FactureFourn($db);
|
$fac = new FactureFourn($db);
|
||||||
$fac->delete($facid);
|
$fac->delete($facid);
|
||||||
|
|
||||||
@ -94,64 +112,60 @@ if ($mode == 'search')
|
|||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Mode Liste
|
||||||
* Mode fiche
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($socid > 0)
|
print_barre_liste("Liste des factures fournisseurs", $page, $PHP_SELF);
|
||||||
{
|
|
||||||
|
|
||||||
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
|
$sortorder="DESC";
|
||||||
}
|
}
|
||||||
else
|
if ($sortfield == "")
|
||||||
{
|
{
|
||||||
/*
|
$sortfield="fac.paye ASC, fac.datef";
|
||||||
* Mode Liste
|
}
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
print_barre_liste("Liste des factures fournisseurs", $page, $PHP_SELF);
|
|
||||||
|
|
||||||
if ($sortorder == "")
|
|
||||||
|
$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.total_ht, fac.paye, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid, fac.facnumber";
|
||||||
|
$sql .= " FROM societe as s, llx_facture_fourn as fac ";
|
||||||
|
$sql .= " WHERE fac.fk_soc = s.idp";
|
||||||
|
|
||||||
|
if ($socid)
|
||||||
|
{
|
||||||
|
$sql .= " AND s.idp = $socid";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
if ($sortorder == "DESC")
|
||||||
|
{
|
||||||
|
$sortorder="ASC";
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$sortorder="DESC";
|
$sortorder="DESC";
|
||||||
}
|
}
|
||||||
if ($sortfield == "")
|
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||||
|
print '<TR class="liste_titre">';
|
||||||
|
print '<TD>Numéro</TD>';
|
||||||
|
print '<TD>Libellé</TD><td>';
|
||||||
|
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
||||||
|
print '</td><TD align="right">Montant</TD>';
|
||||||
|
print '<td align="center">Payé</td>';
|
||||||
|
print "</TR>\n";
|
||||||
|
$var=True;
|
||||||
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$sortfield="fac.paye ASC, fac.datef";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.prefix_comm, fac.total_ht, fac.paye, fac.libelle, ".$db->pdate("fac.datef")." as datef, fac.rowid as facid, fac.facnumber";
|
|
||||||
$sql .= " FROM societe as s, llx_facture_fourn as fac ";
|
|
||||||
$sql .= " WHERE fac.fk_soc = s.idp";
|
|
||||||
|
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
|
|
||||||
if ($result) {
|
|
||||||
$num = $db->num_rows();
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
if ($sortorder == "DESC")
|
|
||||||
{
|
|
||||||
$sortorder="ASC";
|
|
||||||
} else {
|
|
||||||
$sortorder="DESC";
|
|
||||||
}
|
|
||||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
|
||||||
print '<TR class="liste_titre">';
|
|
||||||
print '<TD>Numéro</TD>';
|
|
||||||
print '<TD>Libellé</TD><td>';
|
|
||||||
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
|
||||||
print '</td><TD align="right">Montant</TD>';
|
|
||||||
print '<td align="center">Payé</td>';
|
|
||||||
print "</TR>\n";
|
|
||||||
$var=True;
|
|
||||||
while ($i < $num) {
|
|
||||||
$obj = $db->fetch_object( $i);
|
$obj = $db->fetch_object( $i);
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -170,10 +184,12 @@ else
|
|||||||
}
|
}
|
||||||
print "</TABLE>";
|
print "</TABLE>";
|
||||||
$db->free();
|
$db->free();
|
||||||
} else {
|
|
||||||
print $db->error();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
|||||||
@ -38,12 +38,19 @@ function llxHeader($head = "", $urlp = "") {
|
|||||||
|
|
||||||
$menu->add("/fourn/index.php3", "Fournisseurs");
|
$menu->add("/fourn/index.php3", "Fournisseurs");
|
||||||
|
|
||||||
|
if ($user->societe_id == 0)
|
||||||
|
{
|
||||||
|
$menu->add_submenu("/soc.php3?&action=create","Nouvelle société");
|
||||||
|
}
|
||||||
|
|
||||||
$menu->add_submenu("/soc.php3?&action=create","Nouvelle sociétée");
|
|
||||||
$menu->add_submenu("contact.php3","Contacts");
|
$menu->add_submenu("contact.php3","Contacts");
|
||||||
|
|
||||||
$menu->add("/fourn/facture/index.php3", "Factures");
|
$menu->add("/fourn/facture/index.php3", "Factures");
|
||||||
$menu->add_submenu("fiche.php3?action=create","Nouvelle");
|
|
||||||
|
if ($user->societe_id == 0)
|
||||||
|
{
|
||||||
|
$menu->add_submenu("fiche.php3?action=create","Nouvelle");
|
||||||
|
}
|
||||||
|
|
||||||
left_menu($menu->liste);
|
left_menu($menu->liste);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,20 +23,35 @@ require("./pre.inc.php3");
|
|||||||
require("../contact.class.php3");
|
require("../contact.class.php3");
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$db = new Db();
|
$db = new Db();
|
||||||
if ($sortorder == "") {
|
|
||||||
|
/*
|
||||||
|
* Sécurité accés client
|
||||||
|
*/
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
$sortorder="ASC";
|
$sortorder="ASC";
|
||||||
}
|
}
|
||||||
if ($sortfield == "") {
|
if ($sortfield == "")
|
||||||
|
{
|
||||||
$sortfield="nom";
|
$sortfield="nom";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'attribute_prefix') {
|
if ($action == 'attribute_prefix')
|
||||||
|
{
|
||||||
$societe = new Societe($db, $socid);
|
$societe = new Societe($db, $socid);
|
||||||
$societe->attribute_prefix($db, $socid);
|
$societe->attribute_prefix($db, $socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'recontact') {
|
if ($action == 'recontact')
|
||||||
|
{
|
||||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||||
$sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
|
$sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -99,7 +114,6 @@ if ($mode == 'search') {
|
|||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
$societe = new Societe($db, $socid);
|
$societe = new Societe($db, $socid);
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
|
$sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
|
||||||
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
|
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
|
||||||
|
|
||||||
@ -362,14 +376,14 @@ if ($socid > 0) {
|
|||||||
print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
|
print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
|
||||||
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
print $db->error() . "<br>" . $sql;
|
print $db->error() . "<br>" . $sql;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print "Erreur";
|
print "Erreur";
|
||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -42,12 +42,15 @@ function llxHeader($head = "", $urlp = "") {
|
|||||||
*/
|
*/
|
||||||
if ($user->societe_id == 0)
|
if ($user->societe_id == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$menu->add_submenu("/soc.php3?&action=create","Nouvelle société");
|
$menu->add_submenu("/soc.php3?&action=create","Nouvelle société");
|
||||||
$menu->add_submenu("contact.php3","Contacts");
|
}
|
||||||
|
|
||||||
|
$menu->add_submenu("contact.php3","Contacts");
|
||||||
|
|
||||||
$menu->add("/fourn/facture/index.php3", "Factures");
|
$menu->add("/fourn/facture/index.php3", "Factures");
|
||||||
|
|
||||||
|
if ($user->societe_id == 0)
|
||||||
|
{
|
||||||
$menu->add_submenu("/fourn/facture/fiche.php3?action=create","Nouvelle");
|
$menu->add_submenu("/fourn/facture/fiche.php3?action=create","Nouvelle");
|
||||||
}
|
}
|
||||||
left_menu($menu->liste);
|
left_menu($menu->liste);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user