diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index d6c17337176b455b6df97882a0b90f7a4337ae7f..f6bdb81345c25fba739a7e27c38a23811236c896 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -125,29 +125,32 @@ if ($result) //print '<tr><td width="30%" class="notopnoleft" valign="top">'; print '<div class="fichecenter"><div class="fichethirdleft">'; +// Search contact/address +if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire) +{ + $listofsearchfields['search_member']=array('text'=>'Member'); +} + +if (count($listofsearchfields)) +{ + print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<table class="noborder nohover centpercent">'; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; + print '<tr>'; + print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>'; + if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; + print '</tr>'; + $i++; + } + print '</table>'; + print '</form>'; + print '<br>'; +} -// Formulaire recherche adherent -print '<form action="list.php" method="post">'; -print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; -print '<input type="hidden" name="action" value="search">'; -print '<table class="noborder nohover" width="100%">'; -print '<tr class="liste_titre">'; -print '<td colspan="3">'.$langs->trans("SearchAMember").'</td>'; -print "</tr>\n"; -$var=false; -print "<tr ".$bc[$var].">"; -print '<td>'; -print '<label for="search_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="16">'; -print '</td><td rowspan="3"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>'; -print "<tr ".$bc[$var].">"; -print '<td>'; -print '<label for="search_lastname">'.$langs->trans("Name").'</label>:</td><td><input type="text" name="search_lastname" id="search_lastname" class="flat" size="16">'; -print '</td></tr>'; -print "<tr ".$bc[$var].">"; -print '<td>'; -print '<label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="16">'; -print '</td></tr>'; -print "</table></form>"; /* @@ -156,7 +159,6 @@ print "</table></form>"; if ($conf->use_javascript_ajax) { - print '<br>'; print '<table class="noborder nohover" width="100%">'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>'; print '<tr '.$bc[0].'><td align="center" colspan="2">'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e4993eacb888e71399f6c1fd58081f1d0aa51d20..fc090ef52e059be70c3d501bf5b4f59915cf5992 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -107,6 +107,16 @@ $hookmanager->initHooks(array('invoicelist')); $now=dol_now(); +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'f.facnumber'=>'Ref', + 'f.ref_client'=>'RefCustomer', + 'fd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'f.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; + /* * Actions @@ -134,6 +144,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $month=''; } + /* * View @@ -232,7 +243,7 @@ if (! $sall) } else { - $sql .= natural_search(array('s.nom', 'f.facnumber', 'f.note_public', 'fd.description'), $sall); + $sql .= natural_search(array_keys($fieldstosearchall), $sall); } $sql.= ' ORDER BY '; $listfield=explode(',',$sortfield); @@ -275,7 +286,19 @@ if ($resql) $i = 0; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n"; - + if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="list">'; + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; + print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; + + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall)); + } + // If the user can view prospects other than his' $moreforfilter=''; if ($user->rights->societe->client->voir || $socid) diff --git a/htdocs/core/search.php b/htdocs/core/search.php index a0b6146caf65ffddf1090024e99d4b5afb6359d6..0307a8c77d112aafc60d2e23163cf1c4fc5d77c0 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -109,6 +109,22 @@ if (GETPOST('search_holiday') != '') header("Location: ".DOL_URL_ROOT.'/holiday/list.php?mode=search&sall='.urlencode(GETPOST('search_holiday'))); exit; } +if (GETPOST('search_member') != '') +{ + header("Location: ".DOL_URL_ROOT.'/adherents/list.php?mode=search&sall='.urlencode(GETPOST('search_member'))); + exit; +} +if (GETPOST('search_project') != '') +{ + header("Location: ".DOL_URL_ROOT.'/projet/list.php?mode=search&search_all='.urlencode(GETPOST('search_project'))); + exit; +} +if (GETPOST('search_task') != '') +{ + header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php?mode=search&search_all='.urlencode(GETPOST('search_task'))); + exit; +} + // If we are here, search was called with no supported criteria diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 9227b1a26eb514aa47f975c47c7424a0ee9e8bfc..14389887faa50ddacb4c12c422dd718e6f934be9 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -61,6 +61,20 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_amount=""; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('orderlist')); + + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'd.rowid'=>'Id', + 'd.ref'=>'Ref', + 'd.lastname'=>'Lastname', + 'd.firstname'=>'Firstname', +); + + + /* * View */ @@ -87,7 +101,7 @@ if (trim($search_ref) != '') } if (trim($search_all) != '') { - $sql .= natural_search(array('d.rowid', 'd.ref', 'd.lastname', 'd.firstname', 'd.societe'), $search_all); + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } if (trim($search_company) != '') { @@ -126,6 +140,18 @@ if ($resql) print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n"; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="list">'; + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; + print '<input type="hidden" name="type" value="'.$type.'">'; + + if ($search_all) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); + } + print "<table class=\"noborder\" width=\"100%\">"; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 05459d0bd69e4220c19caa7265869c18ab5c3b62..ccf7169219b2700d5aa95971cf048c4cb5e6a1b4 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -68,6 +68,7 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="fac.datef,fac.rowid"; +$search_all = GETPOST('sall'); $search_ref = GETPOST("search_ref","int"); $search_ref_supplier = GETPOST("search_ref_supplier","alpha"); $search_label = GETPOST("search_label","alpha"); @@ -86,6 +87,7 @@ $optioncss = GETPOST('optioncss','alpha'); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers { + $search_all=""; $search_ref=""; $search_ref_supplier=""; $search_label=""; @@ -97,6 +99,18 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $filter=""; } +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'fac.ref'=>'Ref', + 'fac.ref_supplier'=>'RefSupplier', + //'fd.description'=>'Description', + 's.nom'=>"ThirdParty", + 'fac.note_public'=>'NotePublic', +); +if (empty($user->socid)) $fieldstosearchall["fac.note_private"]="NotePrivate"; + + + /* * Actions */ @@ -157,7 +171,10 @@ if ($filter && $filter != -1) // GETPOST('filtre') may be a string $sql .= " AND " . $filt[0] . " = " . $filt[1]; } } - +if ($search_all) +{ + $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +} if ($search_ref) { if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref); @@ -255,6 +272,18 @@ if ($resql) print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="list">'; + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; + print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; + + if ($search_all) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); + } + print '<table class="liste" width="100%">'; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder); diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index be97ad37a331daa92873f4e911d76251ea4cc27f..1be05aed2d83c34c6486cd0e42b44ecf1154e692 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -68,30 +68,35 @@ else print '<div class="fichecenter"><div class="fichethirdleft">'; - -// Search task +// Search project if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { - $var=false; - print '<form method="post" action="'.DOL_URL_ROOT.'/projet/tasks/index.php">'; + $listofsearchfields['search_task']=array('text'=>'Task'); +} + +if (count($listofsearchfields)) +{ + print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="mode" value="'.$mine.'">'; - print '<input type="hidden" name="search_status" value="-1">'; // All status - print '<table class="noborder nohover" width="100%">'; - print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATask").'</td></tr>'; - print '<tr '.$bc[$var].'>'; - print '<td class="nowrap"><label for="sf_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_task_ref" id="sf_ref" size="18"></td>'; - print '<td rowspan="3"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; - //print '<tr '.$bc[$var].'><td class="nowrap"><label for="syear">'.$langs->trans("Year").'</label>:</td><td><input type="text" class="flat" name="search_year" id="search_year" size="18"></td>'; - print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="search_task_label" id="search_task_label" size="18"></td>'; - print '</tr>'; - print "</table></form>\n"; - print "<br>\n"; + print '<table class="noborder nohover centpercent">'; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; + print '<tr>'; + print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>'; + if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; + print '</tr>'; + $i++; + } + print '</table>'; + print '</form>'; + print '<br>'; } /* Affichage de la liste des projets d'aujourd'hui */ -print '<br><table class="noborder" width="100%">'; +print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td width="50%">'.$langs->trans('ActivityOnProjectToday').'</td>'; print '<td width="50%" align="right">'.$langs->trans("Time").'</td>'; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index e316603c2b75e865002f49564066b22b4680e3af..2f45dce9906da271b8537472969e48f93f8b0955 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -101,19 +101,27 @@ print '<div class="fichecenter"><div class="fichethirdleft">'; // Search project if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { - $var=false; - print '<form method="post" action="'.DOL_URL_ROOT.'/projet/list.php">'; + $listofsearchfields['search_project']=array('text'=>'Project'); +} + +if (count($listofsearchfields)) +{ + print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<table class="noborder nohover" width="100%">'; - print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProject").'</td></tr>'; - print '<tr '.$bc[$var].'>'; - print '<td class="nowrap"><label for="sf_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_ref" id="sf_ref" size="18"></td>'; - print '<td rowspan="3"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; - print '<tr '.$bc[$var].'><td class="nowrap"><label for="syear">'.$langs->trans("Year").'</label>:</td><td><input type="text" class="flat" name="search_year" id="search_year" size="18"></td>'; - print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="search_all" id="search_all" size="18"></td>'; - print '</tr>'; - print "</table></form>\n"; - print "<br>\n"; + print '<table class="noborder nohover centpercent">'; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; + print '<tr>'; + print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>'; + if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; + print '</tr>'; + $i++; + } + print '</table>'; + print '</form>'; + print '<br>'; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index ad617d2c849912ef663d7f2b5100f3a1d91e36b5..17aa5cac22263c3414d0c28aeaa3cb7721009599 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -242,6 +242,11 @@ if ($resql) print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; + print '<input type="hidden" name="action" value="list">'; + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; + print '<input type="hidden" name="type" value="'.$type.'">'; // Show description of content if ($mine) print $langs->trans("MyProjectsDesc").'<br><br>'; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 39484f05014d200843798fe7d7fef222d2ae8010..cd8e3af37bd474c1a9f9aa9e6c9ffa193f5b6640 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -33,6 +33,8 @@ $langs->load('projects'); $langs->load('users'); $id=GETPOST('id','int'); + +$search_all=GETPOST('search_all'); $search_project=GETPOST('search_project'); if (! isset($_GET['search_status']) && ! isset($_POST['search_status'])) $search_status=1; else $search_status=GETPOST('search_status'); @@ -55,8 +57,9 @@ $page = $page == -1 ? 0 : $page; $mine = $_REQUEST['mode']=='mine' ? 1 : 0; // Purge criteria -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_all=""; $search_project=""; $search_status=""; $search_task_ref=""; @@ -64,6 +67,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both } if (empty($search_status) && $search_status == '') $search_status=1; +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 't.ref'=>"Ref", + 't.label'=>"Label", +); + /* * Actions @@ -107,6 +116,7 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$so // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents). $morewherefilter=''; +if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosearchall), $search_all); if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref); if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label); $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, $search_task_user); @@ -114,8 +124,21 @@ $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $sea $tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : ''); print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; +if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; +print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; +print '<input type="hidden" name="action" value="list">'; +print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; +print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; +print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="mode" value="'.GETPOST('mode').'">'; +if ($search_all) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall)); +} + + // If the user can view users if ($user->rights->user->user->lire) {