diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 89b6211d644..61ad93660b6 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -258,7 +258,7 @@ $projectstatic=new Project($db); $formcompany=new FormCompany($db); $help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; -llxHeader('',$langs->trans('Proposal'),$help_url); +//llxHeader('',$langs->trans('Proposal'),$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -404,6 +404,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit+1, $offset); $resql=$db->query($sql); + if ($resql) { $objectstatic=new Propal($db); @@ -424,6 +425,18 @@ if ($resql) $num = $db->num_rows($resql); $arrayofselected=is_array($toselect)?$toselect:array(); + + 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.'/comm/propal/card.php?id='.$id); + exit; + } + + llxHeader('',$langs->trans('Proposal'),$help_url); $param='&viewstatut='.urlencode($viewstatut); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index dbe2b29e63a..55e6e2f8ff5 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -233,7 +233,7 @@ $projectstatic=new Project($db); $title=$langs->trans("Orders"); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; -llxHeader('',$title,$help_url); +// llxHeader('',$title,$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -401,6 +401,16 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); + 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.'/commande/card.php?id='.$id); + exit; + } + + llxHeader('',$title,$help_url); + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 83925a38b08..eb7408cabf6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -354,7 +354,7 @@ $facturestatic=new Facture($db); $formcompany=new FormCompany($db); $thirdpartystatic=new Societe($db); -llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); +// llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -532,15 +532,26 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit+1,$offset); -//print $sql; $resql = $db->query($sql); + if ($resql) { $num = $db->num_rows($resql); $arrayofselected=is_array($toselect)?$toselect:array(); + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) + { + $obj = $db->fetch_object($resql); + $id = $obj->id; + + header("Location: ".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$id); + exit; + } + + llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); + if ($socid) { $soc = new Societe($db); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index a08e39e157c..3208dc36f75 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -56,7 +56,8 @@ $search_deliveryyear=GETPOST("search_deliveryyear","int"); $search_deliverymonth=GETPOST("search_deliverymonth","int"); $search_deliveryday=GETPOST("search_deliveryday","int"); -$sall=GETPOST('search_all', 'alphanohtml'); +$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); + $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('search_ref'); $search_refsupp=GETPOST('search_refsupp'); @@ -473,7 +474,7 @@ if ($search_billed > 0) $title.=' - '.$langs->trans("Billed"); //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url=''; -llxHeader('',$title,$help_url); +// llxHeader('',$title,$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -604,9 +605,19 @@ if ($resql) } $num = $db->num_rows($resql); - + $arrayofselected=is_array($toselect)?$toselect:array(); + 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.'/fourn/commande/card.php?id='.$id); + exit; + } + + llxHeader('',$title,$help_url); + $param=''; if ($socid > 0) $param.='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 07b53981faf..38c3ef10a2e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -256,7 +256,7 @@ $facturestatic=new FactureFournisseur($db); $formcompany=new FormCompany($db); $thirdparty=new Societe($db); -llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); +// llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); $sql = "SELECT"; if ($search_all || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -427,6 +427,17 @@ if ($resql) $arrayofselected=is_array($toselect)?$toselect:array(); + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) + { + $obj = $db->fetch_object($resql); + $id = $obj->facid; + + header("Location: ".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$id); + exit; + } + + llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); + if ($socid) { $soc = new Societe($db); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 03d69a7a243..8c3196e1ec6 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -357,6 +357,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); + if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6f3ca7215a7..dac11d34519 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -386,9 +386,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit + 1,$offset); -//print $sql; dol_syslog("list allowed project", LOG_DEBUG); -//print $sql; + $resql = $db->query($sql); if (! $resql) { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 93ff5fab7a8..e1a77f0b824 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -42,7 +42,7 @@ $toselect = GETPOST('toselect', 'array'); $id=GETPOST('id','int'); -$search_all=GETPOST('search_all', 'alphanohtml'); +$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_categ=GETPOST("search_categ",'alpha'); $search_project=GETPOST('search_project'); if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) @@ -336,10 +336,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit + 1,$offset); -//print $sql; dol_syslog("list allowed project", LOG_DEBUG); -//print $sql; + $resql = $db->query($sql); if (! $resql) { diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 642d4610a10..8915532ff22 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -73,6 +73,7 @@ $search_btn=GETPOST('button_search','alpha'); $search_remove_btn=GETPOST('button_removefilter','alpha'); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); + $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $year=GETPOST("year"); $month=GETPOST("month"); @@ -122,10 +123,10 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'p.ref'=>'Ref', + 'sp.ref'=>'Ref', 's.nom'=>'Supplier', 'pd.description'=>'Description', - 'p.note_public'=>'NotePublic', + 'sp.note_public'=>'NotePublic', ); if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate"; @@ -217,6 +218,7 @@ if (empty($reshook)) * View */ + $now=dol_now(); $form = new Form($db); @@ -227,7 +229,7 @@ $companystatic=new Societe($db); $formcompany=new FormCompany($db); $help_url='EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'; -llxHeader('',$langs->trans('CommRequest'),$help_url); +//llxHeader('',$langs->trans('CommRequest'),$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -358,7 +360,20 @@ if ($resql) $num = $db->num_rows($resql); $arrayofselected=is_array($toselect)?$toselect:array(); + + 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.'/supplier_proposal/card.php?id='.$id); + exit; + } + + llxHeader('',$langs->trans('CommRequest'),$help_url); + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;