NEW: redirect to expedition card if global search has unique result (#30108)

This commit is contained in:
Noé Cendrier 2024-06-22 16:08:26 +02:00 committed by GitHub
parent b43fc088b4
commit b0116fd9fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {