diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index c5e83bb7f6f..e9569c98b46 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -517,8 +517,8 @@ if (empty($reshook)) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode(strval($limit)); } - if ($sall) { - $param .= "&sall=".urlencode($sall); + if ($search_all) { + $param .= "&search_all=".urlencode($search_all); } if ($search_ref_exp) { $param .= "&search_ref_exp=".urlencode($search_ref_exp); @@ -642,7 +642,6 @@ $formcompany = new FormCompany($db); $shipment = new Expedition($db); $helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; -llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; if ($search_all || $search_user > 0) { @@ -887,6 +886,16 @@ $num = $db->num_rows($resql); $arrayofselected = is_array($toselect) ? $toselect : array(); +// Redirect to expedition card if there is only one result for global search +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/expedition/card.php?id='.$id); + exit; +} + +llxHeader('', $langs->trans('ListOfSendings'), $helpurl); + $expedition = new Expedition($db); if ($socid > 0) {