From 5e17c2efb90cbdd0d6f3bb90529a15714cb489c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Jul 2017 23:32:55 +0200 Subject: [PATCH] Fix into filters of time consumed --- htdocs/core/lib/project.lib.php | 4 +++ htdocs/projet/activity/perday.php | 43 ++++++++++++++++++++++----- htdocs/projet/activity/perweek.php | 47 ++++++++++++++++++++++++------ htdocs/projet/list.php | 4 +-- 4 files changed, 79 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index c3583e72ac8..366413c376f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -629,9 +629,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr print ''."\n"; // User + /* print ''; print $fuser->getNomUrl(1, 'withproject', 'time'); print ''; + */ // Ref print ''; @@ -835,9 +837,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ print ''."\n"; // User + /* print ''; print $fuser->getNomUrl(1, 'withproject', 'time'); print ''; + */ // Ref print ''; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index a7b243dd338..7b1f50bb50c 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -64,6 +64,7 @@ $day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int" $day = (int) $day; $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); +$search_categ=GETPOST("search_categ",'alpha'); $search_usertoprocessid=GETPOST('search_usertoprocessid', 'int'); $search_task_ref=GETPOST('search_task_ref', 'alpha'); $search_task_label=GETPOST('search_task_label', 'alpha'); @@ -100,13 +101,14 @@ $object=new Task($db); if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $action = ''; + $search_categ=''; $search_usertoprocessid = ''; $search_task_ref = ''; $search_task_label = ''; $search_project_ref = ''; $search_thirdparty = ''; } -if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search")) +if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha')) { $action = ''; } @@ -394,15 +396,41 @@ print ''; print '
'; +$moreforfilter=''; + +// Filter on categories +/*if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ProjectCategories'). ': '; + $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300'); + $moreforfilter.='
'; +}*/ + +// If the user can view user other than himself +$moreforfilter.='
'; +$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; +$includeonly='hierachyme'; +if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); +$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); +$moreforfilter.='
'; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; +} + + print '
'; print ''."\n"; print ''; -print ''; print ''; print ''; print ''; @@ -422,7 +450,6 @@ print ''; print "\n"; print ''; -print ''; print ''; print ''; print ''; @@ -454,7 +481,7 @@ if (count($tasksarray) > 0) } else { - print ''; + print ''; } print "
'; -$usersettoshow='hierarchyme'; -if ($user->rights->projet->all->lire) $usersettoshow=''; -print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150'); -print '
'.$langs->trans("User").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("ProjectRef").'
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; print '
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 5f3e9b1aa20..3410ba1d949 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -65,6 +65,7 @@ $day=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int" $day = (int) $day; $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); +$search_categ=GETPOST("search_categ",'alpha'); $search_usertoprocessid=GETPOST('search_usertoprocessid', 'int'); $search_task_ref=GETPOST('search_task_ref', 'alpha'); $search_task_label=GETPOST('search_task_label', 'alpha'); @@ -113,13 +114,14 @@ $object=new Task($db); if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $action = ''; + $search_categ=''; $search_usertoprocessid = ''; $search_task_ref = ''; $search_task_label = ''; $search_project_ref = ''; $search_thirdparty = ''; } -if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search")) +if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha')) { $action = ''; } @@ -313,6 +315,7 @@ $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); @@ -387,15 +390,42 @@ print ''; print '
'; +$moreforfilter=''; + +// Filter on categories +/* +if (! empty($conf->categorie->enabled)) +{ + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('ProjectCategories'). ': '; + $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300'); + $moreforfilter.='
'; +}*/ + +// If the user can view user other than himself +$moreforfilter.='
'; +$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; +$includeonly='hierachyme'; +if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); +$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); +$moreforfilter.='
'; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; +} + + print '
'; print ''."\n"; print ''; -print ''; print ''; print ''; print ''; @@ -416,7 +446,6 @@ print ''; print "\n"; print ''; -print ''; print ''; print ''; print ''; @@ -453,7 +482,7 @@ if (count($tasksarray) > 0) $level=0; projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask); - $colspan=8; + $colspan=7; if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) $colspan++; print ' @@ -470,7 +499,7 @@ if (count($tasksarray) > 0) } else { - print ''; + print ''; } print "
'; -$usersettoshow='hierarchyme'; -if ($user->rights->projet->all->lire) $usersettoshow=''; -print $form->select_dolusers($usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $usersettoshow, 0, 0, 0, 1, '', 0, '', 'maxwidth150'); -print '
'.$langs->trans("User").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").''.$langs->trans("ProjectRef").'
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 1bf65decd71..9e2971195e3 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -371,6 +371,7 @@ llxHeader("", $title, $help_url); $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_all != '') $param.='&search_all='.$search_all; if ($search_sday) $param.='&search_sday='.$search_sday; if ($search_smonth) $param.='&search_smonth='.$search_smonth; if ($search_syear) $param.='&search_syear=' .$search_syear; @@ -378,7 +379,6 @@ if ($search_eday) $param.='&search_eday='.$search_eday; if ($search_emonth) $param.='&search_emonth='.$search_emonth; if ($search_eyear) $param.='&search_eyear=' .$search_eyear; if ($socid) $param.='&socid='.$socid; -if ($search_all != '') $param.='&search_all='.$search_all; if ($search_ref != '') $param.='&search_ref='.$search_ref; if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; @@ -451,7 +451,7 @@ if (! empty($conf->categorie->enabled)) // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; -$includeonly=''; +$includeonly='hierachyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
';