NEW Show which fields are used for search when doing a generic search
from the quick search form.
This commit is contained in:
parent
45a2156d71
commit
537a13e2f4
@ -78,6 +78,21 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$hookmanager->initHooks(array('memberlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'd.rowid'=>'Ref',
|
||||
//'d.ref'=>'Ref',
|
||||
'd.lastname'=>'Lastname',
|
||||
'd.firstname'=>'Firstname',
|
||||
'd.societe'=>"Company",
|
||||
'd.email'=>'EMail',
|
||||
'd.address'=>'Address',
|
||||
'd.zip'=>'Zip',
|
||||
'd.town'=>'Town',
|
||||
'd.note_public'=>'NotePublic',
|
||||
'd.note_private'=>'NotePrivate',
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -111,7 +126,7 @@ if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ);
|
||||
if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
|
||||
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
|
||||
if ($sall) $sql.=natural_search(array("d.rowid", "d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
|
||||
if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
|
||||
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
if ($search_ref)
|
||||
@ -180,16 +195,16 @@ if ($resql)
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ";
|
||||
print '<strong>'.$sall.'</strong>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
if (! empty($conf->categorie->enabled))
|
||||
|
||||
@ -108,6 +108,14 @@ $viewstatut=$object_statut;
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('propallist'));
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'p.ref'=>'Ref',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
'p.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
@ -192,7 +200,7 @@ if ($search_montant_ht != '')
|
||||
$sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||
@ -264,6 +272,13 @@ if ($result)
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
//sort($fieldstosearchall);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
@ -119,6 +119,13 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETP
|
||||
}
|
||||
if ($search_priv < 0) $search_priv='';
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'p.lastname'=>'Lastname',
|
||||
'p.firstname'=>'Firstname',
|
||||
'p.email'=>'EMail',
|
||||
's.nom'=>"ThirdParty",
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
@ -226,7 +233,7 @@ else if ($type == "p") // filtre sur type
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email', 's.nom'), $sall);
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if (! empty($socid))
|
||||
{
|
||||
@ -279,11 +286,12 @@ if ($result)
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("ThirdParty")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall;
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
}
|
||||
if ($search_firstlast_only)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")."): ".$search_firstlast_only;
|
||||
print $langs->trans("FilterOnInto", $search_firstlast_only, $langs->trans("Lastname").", ".$langs->trans("Firstname"));
|
||||
}
|
||||
|
||||
if (! empty($conf->categorie->enabled))
|
||||
|
||||
@ -386,6 +386,7 @@ NActions=%s events
|
||||
NActionsLate=%s late
|
||||
RequestAlreadyDone=Request already recorded
|
||||
Filter=Filter
|
||||
FilterOnInto=Search criteria '<strong>%s</strong>' into fields %s
|
||||
RemoveFilter=Remove filter
|
||||
ChartGenerated=Chart generated
|
||||
ChartNotGenerated=Chart not generated
|
||||
@ -576,6 +577,7 @@ SendByMail=Send by EMail
|
||||
MailSentBy=Email sent by
|
||||
TextUsedInTheMessageBody=Email body
|
||||
SendAcknowledgementByMail=Send Ack. by email
|
||||
EMail=E-mail
|
||||
NoEMail=No email
|
||||
NoMobilePhone=No mobile phone
|
||||
Owner=Owner
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
# Dolibarr language file - Source file is en_US - products
|
||||
ProductRef=Product ref.
|
||||
ProductLabel=Product label
|
||||
ProductLabelTranslated=Translated product label
|
||||
ProductDescriptionTranslated=Translated product description
|
||||
ProductNoteTranslated=Translated product note
|
||||
ProductServiceCard=Products/Services card
|
||||
Products=Products
|
||||
Services=Services
|
||||
|
||||
@ -84,6 +84,24 @@ if ($type=='0') $result=restrictedArea($user,'produit','','','','','',$objcanvas
|
||||
else if ($type=='1') $result=restrictedArea($user,'service','','','','','',$objcanvas);
|
||||
else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas);
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'p.ref'=>"Ref",
|
||||
'p.label'=>"ProductLabel",
|
||||
'p.description'=>"Description",
|
||||
"p.note"=>"Note",
|
||||
);
|
||||
// multilang
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$fieldstosearchall['pl.label']='ProductLabelTranslated';
|
||||
$fieldstosearchall['pl.description']='ProductDescriptionTranslated';
|
||||
$fieldstosearchall['pl.note']='ProductNoteTranslated';
|
||||
}
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
$fieldstosearchall['p.barcode']='Gencod';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -147,19 +165,7 @@ else
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||
if ($sall)
|
||||
{
|
||||
// For natural search
|
||||
$params = array('p.ref', 'p.label', 'p.description', 'p.note');
|
||||
// multilang
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$params[] = 'pl.label';
|
||||
$params[] = 'pl.description';
|
||||
$params[] = 'pl.note';
|
||||
}
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
$params[] = 'p.barcode';
|
||||
}
|
||||
$sql .= natural_search($params, $sall);
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
// if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (dol_strlen($type))
|
||||
@ -169,16 +175,6 @@ else
|
||||
}
|
||||
if ($sref) $sql .= natural_search('p.ref', $sref);
|
||||
if ($sbarcode) $sql .= natural_search('p.barcode', $sbarcode);
|
||||
if ($snom)
|
||||
{
|
||||
$params = array('p.label');
|
||||
// multilang
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$params[] = 'pl.label';
|
||||
}
|
||||
$sql .= natural_search($params, $snom);
|
||||
}
|
||||
if (isset($tosell) && dol_strlen($tosell) > 0 && $tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($tosell);
|
||||
if (isset($tobuy) && dol_strlen($tobuy) > 0 && $tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($tobuy);
|
||||
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
|
||||
@ -189,8 +185,7 @@ else
|
||||
if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id;
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
|
||||
$sql.= " p.fk_product_type, p.tms,";
|
||||
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
$sql .= ', p.desiredstock';
|
||||
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock";
|
||||
//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -282,6 +277,12 @@ else
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
$colspan=6;
|
||||
|
||||
@ -109,6 +109,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$hookmanager->initHooks(array('projectlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'p.ref'=>"Ref",
|
||||
'p.title'=>"Label",
|
||||
's.nom'=>"ThirdPartyName",
|
||||
"p.note_public"=>"NotePublic"
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
@ -182,7 +190,7 @@ else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all);
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_status >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_status);
|
||||
if ($search_opp_status)
|
||||
{
|
||||
@ -235,7 +243,7 @@ if ($resql)
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
||||
// Show description of content
|
||||
// Show description of content
|
||||
if ($mine) print $langs->trans("MyProjectsDesc").'<br><br>';
|
||||
else
|
||||
{
|
||||
@ -245,8 +253,8 @@ if ($resql)
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Label")." ".$langs->trans("or")." ".$langs->trans("ThirdParty")."): ";
|
||||
print '<strong>'.$search_all.'</strong>';
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
|
||||
}
|
||||
|
||||
$colspan=8;
|
||||
|
||||
@ -86,22 +86,23 @@ $extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
's.nom',
|
||||
's.name_alias',
|
||||
's.code_client',
|
||||
"s.code_fournisseur",
|
||||
's.email',
|
||||
's.url',
|
||||
's.siren',
|
||||
's.siret',
|
||||
's.ape',
|
||||
"s.idprof4",
|
||||
"s.idprof5",
|
||||
"s.idprof6",
|
||||
's.tva_intra'
|
||||
's.nom'=>"ThirdPartyName",
|
||||
's.name_alias'=>"AliasNameShort",
|
||||
's.code_client'=>"CustomerCode",
|
||||
"s.code_fournisseur"=>"SupplierCode",
|
||||
's.email'=>"EMail",
|
||||
's.url'=>"URL",
|
||||
's.tva_intra'=>"VATIntra",
|
||||
's.siren'=>"ProfId1",
|
||||
's.siret'=>"ProfId2",
|
||||
's.ape'=>"ProfId3",
|
||||
);
|
||||
if (!empty($conf->barcode->enabled)) $fieldstosearchall[] = 's.barcode';
|
||||
if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4';
|
||||
if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5';
|
||||
if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6';
|
||||
if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod';
|
||||
|
||||
|
||||
/*
|
||||
@ -249,7 +250,7 @@ if ($search_categ) $sql.= " AND s.rowid = cs.fk_soc"; // Join for the neede
|
||||
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
||||
if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_categ) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
|
||||
if ($search_all) $sql.= natural_search($fieldstosearchall, $search_all);
|
||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_nom) $sql.= natural_search("s.nom",$search_nom);
|
||||
if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only);
|
||||
if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code);
|
||||
@ -360,7 +361,13 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
// Filter on categories
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
/* Not possible in this page because list is for ALL third parties type
|
||||
$moreforfilter='';
|
||||
if (! empty($conf->categorie->enabled))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user