Skip to content
Snippets Groups Projects
Commit 4ddffc65 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Uniformize code

parent b069d6d2
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,7 @@ require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php');
require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
if (!$user->rights->facture->lire)
accessforbidden();
if (!$user->rights->facture->lire) accessforbidden();
$langs->load("companies");
$langs->load("bills");
......@@ -76,7 +75,7 @@ if (! $sortorder) $sortorder="ASC";
if ($user->rights->fournisseur->facture->lire)
{
$sql = "SELECT s.nom, s.rowid as socid,";
$sql = "SELECT s.rowid as socid, s.nom";
$sql.= " f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc,";
$sql.= " f.datef as df, f.date_lim_reglement as datelimite, ";
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut";
......@@ -127,20 +126,19 @@ if ($user->rights->fournisseur->facture->lire)
if (dol_strlen($_POST["sf_ref"]) > 0)
{
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"]."%'";
}
$sql.= " GROUP BY f.facnumber,s.nom, s.rowid, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut";
$sql.= " GROUP BY f.facnumber, f.rowid, f.total_ht, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, s.rowid, s.nom";
$sql.= " ORDER BY ";
$listfield=explode(',',$sortfield);
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
$sql.= " f.facnumber DESC";
$result = $db->query($sql);
if ($result)
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
if ($socid)
{
......@@ -196,11 +194,11 @@ if ($user->rights->fournisseur->facture->lire)
while ($i < $num)
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
$classname = "impayee";
print '<td nowrap>';
......@@ -249,7 +247,7 @@ if ($user->rights->fournisseur->facture->lire)
}
print "</table>";
$db->free();
$db->free($resql);
}
else
{
......@@ -259,9 +257,7 @@ if ($user->rights->fournisseur->facture->lire)
}
llxFooter();
$db->close();
llxFooter();
?>
......@@ -267,7 +267,7 @@ if ($resql)
// Affiche statut de la facture
print '<td align="right" nowrap="nowrap">';
// TODO le montant deja paye obj->am n'est pas definie
// TODO le montant deja paye objp->am n'est pas definie
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$objp->am);
print '</td>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment