ADD extrafields on global search
This commit is contained in:
parent
a61a435095
commit
5a385bf1cc
@ -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)
|
||||
|
||||
@ -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 '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("GlobalSearchOnExtrafield").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
print $form->selectyesno("activate_globalSearchOnExtrafield", (! empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD)?$conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD:0), 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->global->PRODUCT_CANVAS_ABILITY))
|
||||
{
|
||||
// Add canvas feature
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user