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

Fix code generator

parent 7fd01d4a
No related branches found
No related tags found
No related merge requests found
......@@ -252,7 +252,31 @@ if ($action == 'list' || (empty($id) && $action != 'create'))
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog($script_file, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$params='';
$params.= '&search_field1='.urlencode($search_field1);
$params.= '&search_field2='.urlencode($search_field2);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies');
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
......@@ -287,11 +311,6 @@ if ($action == 'list' || (empty($id) && $action != 'create'))
print '</tr>'."\n";
dol_syslog($script_file, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
......@@ -309,12 +328,6 @@ if ($action == 'list' || (empty($id) && $action != 'create'))
}
$i++;
}
}
else
{
$error++;
dol_print_error($db);
}
$db->free($resql);
......@@ -324,6 +337,13 @@ if ($action == 'list' || (empty($id) && $action != 'create'))
print "</table>\n";
print "</form>\n";
}
else
{
$error++;
dol_print_error($db);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment