Missing filters

This commit is contained in:
Laurent Destailleur 2016-12-06 12:13:03 +01:00
parent 1a842d8366
commit bd0b017571
3 changed files with 28 additions and 10 deletions

View File

@ -62,8 +62,10 @@ $month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("mo
$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d"));
$day = (int) $day;
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_task_ref=GETPOST('search_task_ref', 'alpha');
$search_task_label=GETPOST('search_task_label', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_thirdparty=GETPOST('search_thirdparty', 'alpha');
$monthofday=GETPOST('addtimemonth');
$dayofday=GETPOST('addtimeday');
@ -84,7 +86,10 @@ $object=new Task($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$action = '';
$search_task_ref = '';
$search_task_label = '';
$search_project_ref = '';
$search_thirdparty = '';
}
if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search"))
{
@ -293,6 +298,9 @@ if ($id)
$onlyopenedproject=1; // or -1
$morewherefilter='';
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
@ -416,10 +424,11 @@ print '<td align="right">'.$langs->trans("Note").'</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
print '<td class="liste_total"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_total"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print '<td class="liste_total"></td>';
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) print '<td class="liste_total"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';

View File

@ -63,7 +63,10 @@ $month=GETPOST('remonth')?GETPOST('remonth','int'):(GETPOST("month")?GETPOST("mo
$day=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int"):date("d"));
$day = (int) $day;
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_task_ref=GETPOST('search_task_ref', 'alpha');
$search_task_label=GETPOST('search_task_label', 'alpha');
$search_project_ref=GETPOST('search_project_ref', 'alpha');
$search_thirdparty=GETPOST('search_thirdparty', 'alpha');
$startdayarray=dol_get_first_day_week($day, $month, $year);
@ -98,7 +101,10 @@ $object=new Task($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$action = '';
$search_task_ref = '';
$search_task_label = '';
$search_project_ref = '';
$search_thirdparty = '';
}
if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search"))
{
@ -290,6 +296,9 @@ if ($id)
$onlyopenedproject=1; // or -1
$morewherefilter='';
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
@ -415,10 +424,10 @@ print '<td class="liste_total"></td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"><input type="text" size="4" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
print '<td class="liste_total"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
print '<td class="liste_total"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print '<td class="liste_total"></td>';
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print '<td class="liste_total"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';

View File

@ -623,7 +623,7 @@ class Task extends CommonObject
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
* @param string $filteronprojref Filter on project ref
* @param string $filteronprojstatus Filter on project status
* @param string $morewherefilter Add more filter into where SQL request
* @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...')
* @param string $filteronprojuser Filter on user that is a contact of project
* @param string $filterontaskuser Filter on user assigned to task
* @return array Array of tasks