diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 1b67157381e..f07ec4ec980 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -256,55 +256,50 @@ if ( $societe->fetch($socid) ) /* * Liste des factures associées */ - $langs->load("bills"); - - $max=5; - - $sql = "SELECT p.rowid,p.libelle,p.facnumber,p.fk_statut,".$db->pdate("p.datef")." as df, total_ttc as amount, paye"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as p"; - $sql.= " WHERE p.fk_soc = ".$societe->id; - $sql.= " ORDER BY p.datef DESC"; - $sql.= " ".$db->plimit($max+1); - - $resql=$db->query($sql); - if ($resql) - { - $i = 0 ; - $num = $db->num_rows($resql); - if ($num > 0) - { - print ''; - print ''; - print ""; - } - $facturestatic = new FactureFournisseur($db); - while ($i < min($num,$max)) - { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - print ''; - print ''; - print ''; - print ''; - print ""; - $i++; - } - $db->free($resql); - if ($num > 0) - { - print "
"; - print "
".$langs->trans("LastSuppliersBills",min($num,$max))."id\">".$langs->trans("AllBills")." (".$num.")
"; - print "
'; - print ''; - print img_object($langs->trans("ShowBill"),"bill")." ".$obj->facnumber.' '.dolibarr_trunc($obj->libelle,14).''.dolibarr_print_date($obj->df).''.price($obj->amount).''.$facturestatic->LibStatutShort($obj->paye,$obj->fk_statut).'

"; - } - } - else - { - dolibarr_print_error($db); - } + $langs->load('bills'); + $max=5; + $sql = 'SELECT p.rowid,p.libelle,p.facnumber,p.fk_statut,'.$db->pdate('p.datef').' as df, total_ttc as amount, paye'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as p'; + $sql.= ' WHERE p.fk_soc = '.$societe->id; + $sql.= ' ORDER BY p.datef DESC'; + $resql=$db->query($sql); + if ($resql) + { + $i = 0 ; + $num = $db->num_rows($resql); + if ($num > 0) + { + print ''; + print ''; + print ''; + } + $facturestatic = new FactureFournisseur($db); + while ($i < min($num,$max)) + { + $obj = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + $db->free($resql); + if ($num > 0) + { + print '
'; + print '
'.$langs->trans('LastSuppliersBills',min($num,$max)).''.$langs->trans('AllBills').' ('.$num.')
'; + print '
'; + print ''; + print img_object($langs->trans('ShowBill'),'bill').' '.$obj->facnumber.' '.dolibarr_trunc($obj->libelle,14).''.dolibarr_print_date($obj->df).''.price($obj->amount).''.$facturestatic->LibStatutShort($obj->paye,$obj->fk_statut).'

'; + } + } + else + { + dolibarr_print_error($db); + } /* *