Modif sécurité accés client
This commit is contained in:
parent
fd4be51aa3
commit
81a6799218
@ -30,6 +30,7 @@ require("../facture.class.php");
|
|||||||
/*
|
/*
|
||||||
* Sécurité accés client
|
* Sécurité accés client
|
||||||
*/
|
*/
|
||||||
|
$socid = $_GET["socid"];
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -130,17 +131,15 @@ if ($mode == 'search')
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Mode fiche
|
* Mode fiche
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($_GET["socid"] > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($_GET["socid"], $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
|
|||||||
@ -79,13 +79,19 @@ print "</table></form>";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($conf->facture->enabled) {
|
if ($conf->facture->enabled)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Factures brouillons
|
* Factures brouillons
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
|
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s WHERE s.idp = f.fk_soc AND f.fk_statut = 0";
|
||||||
|
|
||||||
|
if ($socidp)
|
||||||
|
{
|
||||||
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
}
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
@ -114,7 +120,6 @@ else
|
|||||||
{
|
{
|
||||||
print $sql;
|
print $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->compta->enabled) {
|
if ($conf->compta->enabled) {
|
||||||
@ -238,7 +243,8 @@ if ($user->comm > 0 && $conf->commercial->enabled )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($conf->facture->enabled) {
|
if ($conf->facture->enabled)
|
||||||
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Factures impayées
|
* Factures impayées
|
||||||
@ -248,6 +254,10 @@ if ($conf->facture->enabled) {
|
|||||||
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total_ttc, sum(pf.amount) as am";
|
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total_ttc, sum(pf.amount) as am";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||||
$sql .= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
$sql .= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
|
||||||
|
if ($socidp)
|
||||||
|
{
|
||||||
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
}
|
||||||
$sql .= " GROUP BY f.facnumber";
|
$sql .= " GROUP BY f.facnumber";
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
if ( $db->query($sql) )
|
||||||
@ -284,7 +294,6 @@ else
|
|||||||
{
|
{
|
||||||
print $sql;
|
print $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -22,10 +22,16 @@
|
|||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -73,6 +79,10 @@ if ($_GET["id"])
|
|||||||
$sql = "SELECT distinct(f.rowid), s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
$sql = "SELECT distinct(f.rowid), s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as d WHERE f.fk_soc = s.idp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as d WHERE f.fk_soc = s.idp";
|
||||||
$sql .= " AND d.fk_facture = f.rowid AND d.fk_product =".$product->id;
|
$sql .= " AND d.fk_facture = f.rowid AND d.fk_product =".$product->id;
|
||||||
|
if ($socid)
|
||||||
|
{
|
||||||
|
$sql .= " AND f.fk_soc = $socid";
|
||||||
|
}
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||||
$sql .= $db->plimit( $limit ,$offset);
|
$sql .= $db->plimit( $limit ,$offset);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user