Qual: Uniformize code

This commit is contained in:
Laurent Destailleur 2012-01-12 20:37:31 +01:00
parent b069d6d2f1
commit 4ddffc6506
2 changed files with 12 additions and 16 deletions

View File

@ -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.'/fourn/class/fournisseur.facture.class.php');
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
if (!$user->rights->facture->lire) if (!$user->rights->facture->lire) accessforbidden();
accessforbidden();
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
@ -76,7 +75,7 @@ if (! $sortorder) $sortorder="ASC";
if ($user->rights->fournisseur->facture->lire) 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.rowid as ref, f.facnumber, f.total_ht, f.total_ttc,";
$sql.= " f.datef as df, f.date_lim_reglement as datelimite, "; $sql.= " f.datef as df, f.date_lim_reglement as datelimite, ";
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut"; $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) 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 "; $sql.= " ORDER BY ";
$listfield=explode(',',$sortfield); $listfield=explode(',',$sortfield);
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
$sql.= " f.facnumber DESC"; $sql.= " f.facnumber DESC";
$result = $db->query($sql); $resql = $db->query($sql);
if ($resql)
if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($resql);
if ($socid) if ($socid)
{ {
@ -196,11 +194,11 @@ if ($user->rights->fournisseur->facture->lire)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr ".$bc[$var].">";
$classname = "impayee"; $classname = "impayee";
print '<td nowrap>'; print '<td nowrap>';
@ -249,7 +247,7 @@ if ($user->rights->fournisseur->facture->lire)
} }
print "</table>"; print "</table>";
$db->free(); $db->free($resql);
} }
else else
{ {
@ -259,9 +257,7 @@ if ($user->rights->fournisseur->facture->lire)
} }
llxFooter();
$db->close(); $db->close();
llxFooter();
?> ?>

View File

@ -267,7 +267,7 @@ if ($resql)
// Affiche statut de la facture // Affiche statut de la facture
print '<td align="right" nowrap="nowrap">'; 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 $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$objp->am);
print '</td>'; print '</td>';