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

Fix: Le lien sur la liste des factures fournisseurs depuis l'onglet...

Fix: Le lien sur la liste des factures fournisseurs depuis l'onglet fournisseur et le tri de cette liste ne fonctionnait pas.
parent b7866d9d
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,8 @@ require("../../facturefourn.class.php");
llxHeader();
$socid = $_GET["socid"];
/*
* Scurit accs client
*/
......@@ -64,11 +66,10 @@ $pagenext = $page + 1;
/*
* Recherche
*
*
*/
if ($mode == 'search')
if ($_POST["mode"] == 'search')
{
if ($mode-search == 'soc')
if ($_POST["mode-search"] == 'soc')
{
$sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s ";
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
......@@ -130,17 +131,22 @@ if ($result)
$num = $db->num_rows();
$i = 0;
print_barre_liste("Liste des factures fournisseurs", $page, "index.php",'', $sortfield, $sortorder,'',$num);
if ($socid) {
$soc = new Societe($db);
$soc->fetch($socid);
}
print_barre_liste("Factures fournisseur".($socid?" $soc->nom":""),$page,"index.php","&socidp=$socidp",$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","","","",$sortfield);
print_liste_field_titre($langs->trans("Date"),"index.php","fac.datef","","","",$sortfield);
print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","","","",$sortfield);
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield);
print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","","",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("AmountTTC"),"index.php","fac.total_ttc","","",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("Status"),"index.php","fk_statut,paye","","",'align="center"',$sortfield);
print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("Date"),"index.php","fac.datef","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&amp;socid=$socid","","",$sortfield);
print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","&amp;socid=$socid","",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("AmountTTC"),"index.php","fac.total_ttc","&amp;socid=$socid","",'align="right"',$sortfield);
print_liste_field_titre($langs->trans("Status"),"index.php","fk_statut,paye","&amp;socid=$socid","",'align="center"',$sortfield);
print "</tr>\n";
$var=True;
while ($i < min($num,$limit))
......
......@@ -162,7 +162,7 @@ if ( $societe->fetch($socid) )
$sql = "SELECT p.rowid,p.ref,".$db->pdate("p.date_commande")." as dc, p.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
$sql .= " WHERE p.fk_soc =".$societe->id;
$sql .= " ORDER BY p.rowid DESC LIMIT 0,4";
$sql .= " ORDER BY p.rowid DESC LIMIT 4";
if ( $db->query($sql) )
{
$var=!$var;
......@@ -172,7 +172,7 @@ if ( $societe->fetch($socid) )
{
print '<table class="border" width="100%">';
print "<tr $bc[$var]>";
print "<td colspan=\"2\"><a href=\"commande/liste.php?socid=$societe->id\">Dernires commandes</td></tr>";
print "<td colspan=\"2\"><a href=\"commande/liste.php?socid=$societe->id\">Dernires commandes ($num)</td></tr>";
}
while ($i < $num && $i < 5)
{
......@@ -214,7 +214,7 @@ if ( $societe->fetch($socid) )
*/
$sql = "SELECT p.rowid,p.libelle,p.facnumber,".$db->pdate("p.datef")." as df, total_ttc as amount, paye";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as p WHERE p.fk_soc = $societe->id";
$sql .= " ORDER BY p.datef DESC LIMIT 0,4";
$sql .= " ORDER BY p.datef DESC LIMIT 4";
if ( $db->query($sql) )
{
$var=!$var;
......@@ -224,7 +224,7 @@ if ( $societe->fetch($socid) )
{
print '<table class="border" width="100%">';
print "<tr $bc[$var]>";
print "<td colspan=\"4\"><a href=\"facture/index.php?socid=$societe->id\">Liste des factures fournisseurs ($num)</td></tr>";
print "<td colspan=\"4\"><a href=\"facture/index.php?socid=$societe->id\">Dernires factures fournisseurs ($num)</td></tr>";
}
while ($i < $num && $i < 5)
{
......@@ -235,7 +235,7 @@ if ( $societe->fetch($socid) )
print '<td>';
print '<a href="facture/fiche.php?facid='.$obj->rowid.'">';
print $obj->facnumber.'</a> '.substr($obj->libelle,0,40).'...</td>';
print "<td align=\"right\" width=\"100\">".dolibarr_print_date($obj->df)."</td>";
print "<td align=\"right\" width=\"80\">".dolibarr_print_date($obj->df)."</td>";
print '<td align="right">'.$obj->amount.'</td>';
$fac = new FactureFourn($db);
print '<td align="center">'.$fac->LibStatut($obj->paye,$obj->statut).'</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