Fix on filter on project list
This commit is contained in:
parent
800aa4d5b6
commit
2f68d446ef
@ -29,7 +29,9 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
$search_project_user = GETPOST('search_project_user','int');
|
||||||
|
$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0;
|
||||||
|
if ($search_project_user == $user->id) $mine = 1;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -33,8 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0;
|
|
||||||
$search_project_user = GETPOST('search_project_user','int');
|
$search_project_user = GETPOST('search_project_user','int');
|
||||||
|
$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0;
|
||||||
|
if ($search_project_user == $user->id) $mine = 1;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -261,8 +261,8 @@ if ($search_project_user > 0)
|
|||||||
}
|
}
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('project').')';
|
$sql.= " WHERE p.entity IN (".getEntity('project').')';
|
||||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
|
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
|
||||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
// No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
if ($socid > 0) $sql.= " AND (p.fk_soc = ".$socid.")";
|
||||||
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
|
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
|
||||||
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||||
@ -487,19 +487,25 @@ print '<tr class="liste_titre_filter">';
|
|||||||
if (! empty($arrayfields['p.ref']['checked']))
|
if (! empty($arrayfields['p.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="6">';
|
print '<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="6">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.title']['checked']))
|
if (! empty($arrayfields['p.title']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_label" size="8" value="'.$search_label.'">';
|
print '<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_societe" size="8" value="'.$search_societe.'">';
|
if ($socid > 0)
|
||||||
|
{
|
||||||
|
$tmpthirdparty=new Societe($db);
|
||||||
|
$tmpthirdparty->fetch($socid);
|
||||||
|
$search_societe=$tmpthirdparty->nom;
|
||||||
|
}
|
||||||
|
print '<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Sale representative
|
// Sale representative
|
||||||
@ -511,8 +517,8 @@ if (! empty($arrayfields['commercial']['checked']))
|
|||||||
if (! empty($arrayfields['p.dateo']['checked']))
|
if (! empty($arrayfields['p.dateo']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.$search_sday.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.dol_escape_htmltag($search_sday).'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.$search_smonth.'">';
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.dol_escape_htmltag($search_smonth).'">';
|
||||||
$formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5);
|
$formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -520,8 +526,8 @@ if (! empty($arrayfields['p.dateo']['checked']))
|
|||||||
if (! empty($arrayfields['p.datee']['checked']))
|
if (! empty($arrayfields['p.datee']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.$search_eday.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.dol_escape_htmltag($search_eday).'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.$search_emonth.'">';
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.dol_escape_htmltag($search_emonth).'">';
|
||||||
$formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5);
|
$formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user