diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index d4135c2273e..b759a023bf3 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -340,3 +340,4 @@ ErrorDestinationProductNotFound=Produit destination non trouvé ErrorProductCombinationNotFound=Variante du produit non trouvé ActionAvailableOnVariantProductOnly=Action disponible uniquement sur la variante du produit ProductsPricePerCustomer=Prix produit par clients +GlobalSearchOnExtrafield=Recherche globale : Appliquer la recherche sur les extrafields (Attention : les dates sont au format YYYY-MM-DD) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index a7e45d488e1..1fb2ac73fcf 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -146,6 +146,10 @@ if ($action == 'other') $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); + + $value = GETPOST('activate_globalSearchOnExtrafield', 'alpha'); + $res = dolibarr_set_const($db, "PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD", $value,'chaine',0,'',$conf->entity); + if ($value) { $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; $resql = $db->query($sql_test); @@ -675,6 +679,13 @@ if (! empty($conf->fournisseur->enabled)) print ''; } +print ''; +print ''.$langs->trans("GlobalSearchOnExtrafield").''; +print ''; +print $form->selectyesno("activate_globalSearchOnExtrafield", (! empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD)?$conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD:0), 1); +print ''; +print ''; + if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { // Add canvas feature diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1a9b5fa1f6f..54a60d8e9bf 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -148,6 +148,22 @@ if (! empty($conf->barcode->enabled)) { $fieldstosearchall['p.barcode']='Gencod'; $fieldstosearchall['pfp.barcode']='GencodBuyPrice'; } +//global search on extrafields +if(!empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD) && !empty($extralabels)) { + foreach($extralabels as $codeExtra => $labelExtra) { + $TExtraTypeNotHandled=array( + 'boolean', + 'select', + 'sellist', + 'radio', + 'checkbox', + 'chkbxlst', + 'link', + 'separate', + ); + if(!in_array($extrafields->attribute_type[$codeExtra], $TExtraTypeNotHandled)) $fieldstosearchall['ef.' . $codeExtra] = $labelExtra; + } +} if (empty($conf->global->PRODUIT_MULTIPRICES)) {