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

Added enhanced patch of sladame

parent e5d23832
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,13 @@ $search_ville=isset($_GET["search_ville"])?$_GET["search_ville"]:$_POST["search_
$search_code=isset($_GET["search_code"])?$_GET["search_code"]:$_POST["search_code"];
/*
* view
*/
llxHeader();
$sql = "SELECT s.rowid, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm, s.code_client";
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st";
......@@ -69,13 +76,15 @@ if ($socname)
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset);
/*
* Affichage liste
*/
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
llxHeader();
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset);
$result = $db->query($sql);
if ($result)
......@@ -84,7 +93,7 @@ if ($result)
$param = "&search_nom=".$search_nom."&search_code=".$search_code."&search_ville=".$search_ville;
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
......
......@@ -102,6 +102,14 @@ if ($socname)
$sortorder = "ASC";
}
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql .= " ORDER BY $sortfield $sortorder, s.nom ASC";
$sql .= $db->plimit($conf->liste_limit+1, $offset);
......@@ -123,7 +131,7 @@ if ($resql)
if (isset($stcomm)) $urladd.="&stcomm=".$stcomm;
print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"],$urladd,$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"],$urladd,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
......@@ -198,7 +206,7 @@ if ($resql)
$i++;
}
if ($num > $conf->liste_limit) print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"],$urladd,$sortfield,$sortorder,'',$num);
if ($num > $conf->liste_limit || $page > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"],$urladd,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print "</table>";
$db->free($resql);
......
......@@ -90,6 +90,15 @@ if ($search_ville)
{
$sql .= " AND s.ville LIKE '%".$search_ville."%'";
}
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$resql = $db->query($sql);
......@@ -100,7 +109,7 @@ if ($resql)
$uadd = "&amp;cat=".$_GET["cat"];
print_barre_liste($langs->trans("ListOfSuppliers"), $page, "liste.php", $uadd, $sortfield, $sortorder, '', $num);
print_barre_liste($langs->trans("ListOfSuppliers"), $page, "liste.php", $uadd, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print '<form action="liste.php?cat='.$_GET["cat"].'" method="GET">';
print '<table class="liste" width="100%">';
......
......@@ -1743,7 +1743,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
{
if($cpt==$page)
{
$pagelist.= "&nbsp;".($page+1);
$pagelist.= "&nbsp;<u>".($page+1).'</u>';
}
else
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment