';
$max=3;
-/*
- * Search invoices
- */
+// Search customer invoices
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
- print '
";
+ $listofsearchfields['search_invoice']=array('text'=>'CustomerInvoice');
}
-
-/*
- * Search supplier invoices
- */
+// Search supplier invoices
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
{
- print '
";
+ $listofsearchfields['search_supplier_invoice']=array('text'=>'SupplierInvoice');
}
-
-/*
- * Search donations
- */
if (! empty($conf->don->enabled) && $user->rights->don->lire)
{
$langs->load("donations");
- print '
";
+ $listofsearchfields['search_donation']=array('text'=>'Donation');
+}
+
+if (count($listofsearchfields))
+{
+ print '
';
+ print '
';
}
/**
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 4082ebbae80..51c834522c8 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -40,6 +40,7 @@ $contactid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,'');
+$sall=GETPOST("sall");
$search_firstlast_only=GETPOST("search_firstlast_only");
$search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname");
@@ -56,13 +57,13 @@ $search_priv=GETPOST("search_priv");
$search_categ=GETPOST("search_categ",'int');
$search_status=GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
+
$optioncss = GETPOST('optioncss','alpha');
$type=GETPOST("type");
$view=GETPOST("view");
-$sall=GETPOST("contactname");
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
@@ -98,8 +99,9 @@ else if ($type == "o")
$urlfiche="";
}
-if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both tests are required to be compatible with all browsers
+if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
{
+ $sall="";
$search_firstlast_only="";
$search_lastname="";
$search_firstname="";
@@ -113,7 +115,6 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both
$search_email="";
$search_skype="";
$search_priv="";
- $sall="";
$seach_status=1;
}
if ($search_priv < 0) $search_priv='';
diff --git a/htdocs/core/search.php b/htdocs/core/search.php
index 6dd5d46c72f..5413ae0d162 100644
--- a/htdocs/core/search.php
+++ b/htdocs/core/search.php
@@ -64,7 +64,40 @@ if (GETPOST('search_contract') != '')
header("Location: ".DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode(GETPOST('search_contract')));
exit;
}
+if (GETPOST('search_invoice') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode(GETPOST('search_invoice')));
+ exit;
+}
+if (GETPOST('search_supplier_invoice') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice')));
+ exit;
+}
+if (GETPOST('search_donation') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation')));
+ exit;
+}
+if (GETPOST('search_product') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/product/list.php?sall='.urlencode(GETPOST('search_product')));
+ exit;
+}
+if (GETPOST('search_thirdparty') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/societe/list.php?mode=search&sall='.urlencode(GETPOST('search_thirdparty')));
+ exit;
+}
+if (GETPOST('search_contact') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact')));
+ exit;
+}
+
+
+
// If we are here, search was called with no supported criteria
if (! empty($_SERVER['HTTP_REFERER']))
{
diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php
index dc90a7c3853..fa63a9e9c06 100644
--- a/htdocs/core/search_page.php
+++ b/htdocs/core/search_page.php
@@ -70,14 +70,14 @@ $searchform = '';
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$langs->load("companies");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'sall', '', 'company');
$nbofsearch++;
}
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'sall', '', 'contact');
$nbofsearch++;
}
@@ -85,7 +85,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{
$langs->load("products");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'sall'.rand(0,10));
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'product');
$nbofsearch++;
}
@@ -100,7 +100,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
{
$langs->load("members");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'sall'.rand(0,10));
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', '', 'member');
$nbofsearch++;
}
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 55b7d9377a3..9227b1a26eb 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -43,6 +43,7 @@ if (! $sortfield) $sortfield="d.datedon";
$limit = $conf->liste_limit;
$statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
+$search_all=GETPOST('sall','alpha');
$search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company','alpha');
$search_name=GETPOST('search_name','alpha');
@@ -51,9 +52,10 @@ $optioncss = GETPOST('optioncss','alpha');
if (!$user->rights->don->lire) accessforbidden();
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
- $search_ref="";
+ $search_all="";
+ $search_ref="";
$search_company="";
$search_name="";
$search_amount="";
@@ -83,6 +85,10 @@ if (trim($search_ref) != '')
{
$sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
}
+if (trim($search_all) != '')
+{
+ $sql .= natural_search(array('d.rowid', 'd.ref', 'd.lastname', 'd.firstname', 'd.societe'), $search_all);
+}
if (trim($search_company) != '')
{
$sql .= natural_search('d.societe', $search_company);
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 638ddbc91a4..9e6869f7302 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1575,13 +1575,13 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$langs->load("companies");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company'));
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company'));
}
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc', img_object('','contact'));
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact'));
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
@@ -1607,7 +1607,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if (! empty($conf->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire)
{
$langs->load("members");
- $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'M', 'searchleftproj', img_object('','projectpub'));
+ $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
}
// Execute hook printSearchForm
@@ -1851,11 +1851,11 @@ function getHelpParamFor($helppagename,$langs)
* @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...)
* @param string $htmlinputname Field Name input form
* @param string $accesskey Accesskey
- * @param string $idname Complement for id to avoid multiple same id in the page
+ * @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page
* @param string $img Image to use
* @return string
*/
-function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='',$img='')
+function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $prefhtmlinputname='',$img='')
{
global $conf,$langs;
@@ -1868,7 +1868,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput
$ret.='