Fix compatibility with old behaviour (direct open of card after a

search)
This commit is contained in:
Laurent Destailleur 2016-07-07 10:26:40 +02:00
parent 2af7a8c584
commit 3c6c509358

View File

@ -254,9 +254,6 @@ $prospectstatic=new Client($db);
$prospectstatic->client=2; $prospectstatic->client=2;
$prospectstatic->loadCacheOfProspStatus(); $prospectstatic->loadCacheOfProspStatus();
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
$title=$langs->trans("ListOfThirdParties"); $title=$langs->trans("ListOfThirdParties");
if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers");
@ -432,11 +429,26 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if (! $resql)
{ {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/societe/soc.php?socid='.$id);
exit;
}
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url);
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@ -1036,12 +1048,5 @@ if ($resql)
print '</form>'; print '</form>';
}
else
{
dol_print_error($db);
}
llxFooter(); llxFooter();
$db->close(); $db->close();