From 33c1fd2a01ad28ec385b02282050cc54a6992a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Sun, 9 Sep 2012 14:43:41 +0200 Subject: [PATCH] Allow to search barcodes in the permanent mini search box Requested by Joaquim in Dolibarr.es forum http://dolibarr.es/index.php/foro/9-sugerencias/1337-buscador-de-la-izquierda/ --- htdocs/product/liste.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index cc052401fa0..a51e7441138 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -129,7 +129,15 @@ else if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; - if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; + if ($sall) + { + $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%'"; + if (! empty($conf->global->MAIN_MODULE_BARCODE)) + { + $sql .= " OR p.barcode LIKE '%".$db->escape($sall)."%'"; + } + $sql .= ')'; + } // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) {