diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 098d29e43114f2d1280f9d5d08010e7873b53478..fabded0537003b36fe29aab0d77f1e53647df093 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -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(); ?> diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index ed084001ef6df2641bca577950f7387cb514b258..372534d9bc050191d0330affab2178b1da3906c0 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -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>';