';
-/*
- * Search expenses
- */
+
+if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
+{
+ $langs->load("holiday");
+ $listofsearchfields['search_holiday']=array('text'=>'TitreRequestCP');
+}
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
$langs->load("trips");
- print '
";
+ $listofsearchfields['search_deplacement']=array('text'=>'ExpenseReport');
}
-
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
{
$langs->load("trips");
- print '
";
+ $listofsearchfields['search_expensereport']=array('text'=>'ExpenseReport');
+}
+if (count($listofsearchfields))
+{
+ print '
';
+ print '
';
}
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 076b6a9b209..fea0708e2a8 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -116,7 +116,7 @@ if (count($listofsearchfields))
{
if ($i == 0) print '
| '.$langs->trans("Search").' |
';
print '
';
- print '| : | | ';
+ print ': | | ';
if ($i == 0) print ' | ';
print '
';
$i++;
diff --git a/htdocs/core/search.php b/htdocs/core/search.php
index 5413ae0d162..a0b6146caf6 100644
--- a/htdocs/core/search.php
+++ b/htdocs/core/search.php
@@ -94,9 +94,22 @@ if (GETPOST('search_contact') != '')
header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact')));
exit;
}
+if (GETPOST('search_deplacement') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/compta/deplacement/list.php?mode=search&sall='.urlencode(GETPOST('search_deplacement')));
+ exit;
+}
+if (GETPOST('search_expensereport') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/expensereport/list.php?mode=search&sall='.urlencode(GETPOST('search_expensereport')));
+ exit;
+}
+if (GETPOST('search_holiday') != '')
+{
+ header("Location: ".DOL_URL_ROOT.'/holiday/list.php?mode=search&sall='.urlencode(GETPOST('search_holiday')));
+ exit;
+}
-
-
// If we are here, search was called with no supported criteria
if (! empty($_SERVER['HTTP_REFERER']))
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index ba3b652a3a9..4a12d25f8f2 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -39,6 +39,7 @@ $socid = $_GET["socid"]?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expensereport','','');
+$sall = GETPOST('sall');
$search_ref = GETPOST('search_ref');
$search_user = GETPOST('search_user','int');
$search_amount_ht = GETPOST('search_amount_ht','alpha');
@@ -66,6 +67,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if ($search_status == '') $search_status=-1;
if ($search_user == '') $search_user=-1;
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array(
+ 'd.ref'=>'Ref',
+ 'u.lastname'=>'Lastname',
+ 'u.firstname'=>"Firstname",
+);
+
+
/*
* View
*/
@@ -101,6 +110,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid";
$sql.= " WHERE d.entity = ".$conf->entity;
+// Search all
+if (!empty($sall))
+{
+ $sql.= natural_search(array_keys($fieldstosearchall), $sall);
+}
// Ref
if(!empty($search_ref)){
$sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'";
@@ -183,6 +197,16 @@ if ($resql)
print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '