Add filter on intervention list
This commit is contained in:
parent
9085d77a3a
commit
433cc236a6
@ -23,7 +23,7 @@
|
|||||||
\brief Page accueil espace fiches interventions
|
\brief Page accueil espace fiches interventions
|
||||||
\ingroup ficheinter
|
\ingroup ficheinter
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||||
@ -52,10 +52,14 @@ $offset = $limit * $page ;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
$search_ref=isset($_GET["search_ref"])?$_GET["search_ref"]:$_POST["search_ref"];
|
||||||
|
$search_company=isset($_GET["search_company"])?$_GET["search_company"]:$_POST["search_company"];
|
||||||
|
$search_desc=isset($_GET["search_desc"])?$_GET["search_desc"]:$_POST["search_desc"];
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -63,13 +67,16 @@ llxHeader();
|
|||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,";
|
$sql.= " f.ref, f.rowid as fichid, f.fk_statut, f.description,";
|
||||||
$sql.= " fd.description as descriptiondetail, ".$db->pdate("fd.date")." as dp, fd.duree,";
|
$sql.= " fd.description as descriptiondetail, ".$db->pdate("fd.date")." as dp, fd.duree,";
|
||||||
$sql.= " s.nom,s.rowid as socid";
|
$sql.= " s.nom, s.rowid as socid";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f)";
|
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid ";
|
$sql.= " WHERE f.fk_soc = s.rowid ";
|
||||||
|
if ($search_ref) $sql .= " AND f.ref like '%".addslashes($search_ref)."%'";
|
||||||
|
if ($search_company) $sql .= " AND s.nom like '%".addslashes($search_company)."%'";
|
||||||
|
if ($search_desc) $sql .= " AND (f.description like '%".addslashes($search_desc)."%' OR fd.description like '%".addslashes($search_desc)."%')";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
@ -88,8 +95,9 @@ if ($result)
|
|||||||
$urlparam="&socid=$socid";
|
$urlparam="&socid=$socid";
|
||||||
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php",$urlparam,$sortfield,$sortorder,'',$num);
|
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php",$urlparam,$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
$i = 0;
|
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print_liste_field_titre($langs->trans("Ref"),"index.php","f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"),"index.php","f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","",$urlparam,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","",$urlparam,'',$sortfield,$sortorder);
|
||||||
@ -99,8 +107,24 @@ if ($result)
|
|||||||
print_liste_field_titre($langs->trans("Duration"),"index.php","fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Duration"),"index.php","fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),"index.php","f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),"index.php","f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
|
||||||
|
print '</td><td class="liste_titre">';
|
||||||
|
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
|
||||||
|
print '</td><td class="liste_titre" colspan="2">';
|
||||||
|
print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="24">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre"> </td>';
|
||||||
|
print '<td class="liste_titre"> </td>';
|
||||||
|
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
$total = 0;
|
$total = 0;
|
||||||
|
$i = 0;
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
@ -124,6 +148,7 @@ if ($result)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print "</form>\n";
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user