Merge duplicate menus/page on projects

This commit is contained in:
Laurent Destailleur 2017-03-14 13:49:04 +01:00
parent fc5d96b84b
commit ec7d48931e
11 changed files with 117 additions and 47 deletions

View File

@ -1226,29 +1226,32 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$langs->load("projects"); $langs->load("projects");
// Project affected to user // Project affected to user
$newmenu->add("/projet/index.php?leftmenu=myprojects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects'); $newmenu->add("/projet/index.php?leftmenu=projects&search_project_user=".GETPOST('search_project_user'), $langs->trans("Projects"), 0, $user->rights->projet->lire, '', $mainmenu, 'projects');
$newmenu->add("/projet/card.php?leftmenu=myprojects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer); $newmenu->add("/projet/card.php?leftmenu=projects&action=create&search_project_user=".GETPOST('search_project_user'), $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/list.php?leftmenu=myprojects&mode=mine&search_status=99", $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/list.php?leftmenu=projects&search_project_user=".GETPOST('search_project_user')."&search_status=99", $langs->trans("List"), 1, $user->rights->projet->lire);
// All project i have permission on // All project i have permission on
/*
$newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects'); $newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects');
$newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
$newmenu->add("/projet/list.php?leftmenu=projects&search_status=99", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/list.php?leftmenu=projects&search_status=99", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
*/
$newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
// Project affected to user // Project affected to user
$newmenu->add("/projet/activity/index.php?leftmenu=mytasks&mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php?leftmenu=tasks&search_project_user=".GETPOST('search_project_user'), $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?leftmenu=mytasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/list.php?leftmenu=mytasks&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/list.php?leftmenu=tasks&search_project_user=".GETPOST('search_project_user'), $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/activity/perweek.php?leftmenu=mytasks&mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->lire); $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks&search_project_user=".GETPOST('search_project_user'), $langs->trans("NewTimeSpent"), 1, $user->rights->projet->lire);
// All project i have permission on // All project i have permission on
$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire); /*$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
$newmenu->add("/projet/tasks/list.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/tasks/list.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/activity/perweek.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->lire); $newmenu->add("/projet/activity/perweek.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->lire);
*/
} }
// Categories // Categories

View File

@ -9,6 +9,9 @@ ProjectsArea=Projects Area
ProjectStatus=Project status ProjectStatus=Project status
SharedProject=Everybody SharedProject=Everybody
PrivateProject=Project contacts PrivateProject=Project contacts
ProjectsImContactFor=Projects I'm explicitely a contact of
AllAllowedProjects=All project I can read (mine + public)
AllProjects=All projects
MyProjectsDesc=This view is limited to projects you are a contact for (whatever is the type). MyProjectsDesc=This view is limited to projects you are a contact for (whatever is the type).
ProjectsPublicDesc=This view presents all projects you are allowed to read. ProjectsPublicDesc=This view presents all projects you are allowed to read.
TasksOnProjectsPublicDesc=This view presents all tasks on projects you are allowed to read. TasksOnProjectsPublicDesc=This view presents all tasks on projects you are allowed to read.
@ -23,6 +26,7 @@ TasksDesc=This view presents all projects and tasks (your user permissions grant
AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task assigned to you. Assign task to yourself if you need to enter time on it. AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task assigned to you. Assign task to yourself if you need to enter time on it.
OnlyYourTaskAreVisible=Only tasks assigned to you are visible. Assign task to yourself if it is not visible and you need to enter time on it. OnlyYourTaskAreVisible=Only tasks assigned to you are visible. Assign task to yourself if it is not visible and you need to enter time on it.
ImportDatasetTasks=Tasks of projects ImportDatasetTasks=Tasks of projects
ProjectCategories=Project tags/categories
NewProject=New project NewProject=New project
AddProject=Create project AddProject=Create project
DeleteAProject=Delete a project DeleteAProject=Delete a project

View File

@ -58,11 +58,27 @@ $taskstatic=new Task($db);
$tasktmp=new Task($db); $tasktmp=new Task($db);
$title=$langs->trans("Activities"); $title=$langs->trans("Activities");
if ($mine) $title=$langs->trans("MyActivities"); //if ($mine) $title=$langs->trans("MyActivities");
llxHeader("",$title); llxHeader("",$title);
print load_fiche_titre($title, '', 'title_project');
// Title for combo list see all projects
$titleall=$langs->trans("AllAllowedProjects");
if (! empty($user->rights->projet->all->lire) && ! $socid) $titleall=$langs->trans("AllProjects");
else $titleall=$langs->trans("AllAllowedProjects").'<br><br>';
$morehtml='';
$morehtml.='<form name="projectform">';
$morehtml.='<SELECT name="mode">';
$morehtml.='<option name="all" value="all"'.($mine?'':' selected').'>'.$titleall.'</option>';
$morehtml.='<option name="mine" value="mine"'.($mine?' selected':'').'>'.$langs->trans("ProjectsImContactFor").'</option>';
$morehtml.='</SELECT>';
$morehtml.='<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'title_project.png', 0, $morehtml);
//print load_fiche_titre($title, '', 'title_project');
if ($mine) print $langs->trans("MyTasksDesc").'<br><br>'; if ($mine) print $langs->trans("MyTasksDesc").'<br><br>';
else else

View File

@ -345,7 +345,7 @@ if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->tr
else else
{ {
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br>'; else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
} }
if ($mine) if ($mine)
{ {

View File

@ -341,7 +341,7 @@ if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->tr
else else
{ {
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br>'; else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
} }
if ($mine) if ($mine)
{ {

View File

@ -34,6 +34,7 @@ $langs->load("projects");
$langs->load("companies"); $langs->load("companies");
$mine = GETPOST('mode')=='mine' ? 1 : 0; $mine = GETPOST('mode')=='mine' ? 1 : 0;
$search_project_user = GETPOST('search_project_user','int');
// Security check // Security check
$socid=0; $socid=0;
@ -59,10 +60,25 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$min
llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos"); llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos");
$text=$langs->trans("ProjectsArea"); $title=$langs->trans("ProjectsArea");
if ($mine) $text=$langs->trans("MyProjectsArea"); //if ($mine) $title=$langs->trans("MyProjectsArea");
print load_fiche_titre($text,'','title_project.png');
// Title for combo list see all projects
$titleall=$langs->trans("AllAllowedProjects");
if (! empty($user->rights->projet->all->lire) && ! $socid) $titleall=$langs->trans("AllProjects");
else $titleall=$langs->trans("AllAllowedProjects").'<br><br>';
$morehtml='';
$morehtml.='<form name="projectform">';
$morehtml.='<SELECT name="search_project_user">';
$morehtml.='<option name="all" value="0"'.($mine?'':' selected').'>'.$titleall.'</option>';
$morehtml.='<option name="mine" value="'.$user->id.'"'.(($search_project_user == $user->id)?' selected':'').'>'.$langs->trans("ProjectsImContactFor").'</option>';
$morehtml.='</SELECT>';
$morehtml.='<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'title_project.png', 0, $morehtml);
// Show description of content // Show description of content
if ($mine) print $langs->trans("MyProjectsDesc").'<br><br>'; if ($mine) print $langs->trans("MyProjectsDesc").'<br><br>';

View File

@ -75,12 +75,12 @@ $search_opp_percent=GETPOST("search_opp_percent",'alpha');
$search_opp_amount=GETPOST("search_opp_amount",'alpha'); $search_opp_amount=GETPOST("search_opp_amount",'alpha');
$search_budget_amount=GETPOST("search_budget_amount",'alpha'); $search_budget_amount=GETPOST("search_budget_amount",'alpha');
$search_public=GETPOST("search_public",'int'); $search_public=GETPOST("search_public",'int');
$search_user=GETPOST('search_user','int'); $search_project_user=GETPOST('search_project_user','int');
$search_sale=GETPOST('search_sale','int'); $search_sale=GETPOST('search_sale','int');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$mine = $_REQUEST['mode']=='mine' ? 1 : 0; $mine = $_REQUEST['mode']=='mine' ? 1 : 0;
if ($mine) { $search_user = $user->id; $mine=0; } if ($mine) { $search_project_user = $user->id; $mine=0; }
$sday = GETPOST('sday','int'); $sday = GETPOST('sday','int');
$smonth = GETPOST('smonth','int'); $smonth = GETPOST('smonth','int');
@ -170,7 +170,7 @@ if (empty($reshook))
$search_budget_amount=''; $search_budget_amount='';
$search_public=""; $search_public="";
$search_sale=""; $search_sale="";
$search_user=''; $search_project_user='';
$sday=""; $sday="";
$smonth=""; $smonth="";
$syear=""; $syear="";
@ -193,7 +193,8 @@ $formother = new FormOther($db);
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$title=$langs->trans("Projects"); $title=$langs->trans("Projects");
if ($search_user == $user->id) $title=$langs->trans("MyProjects"); //if ($search_project_user == $user->id) $title=$langs->trans("MyProjects");
// Get list of project id allowed to user (in a string list separated by coma) // Get list of project id allowed to user (in a string list separated by coma)
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
@ -238,7 +239,7 @@ if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_proje
// For external user, no check is done on company permission because readability is managed by public status of project and assignement. // For external user, no check is done on company permission because readability is managed by public status of project and assignement.
//if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; //if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
if ($search_sale > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_sale > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
if ($search_user > 0) if ($search_project_user > 0)
{ {
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
} }
@ -296,7 +297,7 @@ if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale;
// For external user, no check is done on company permission because readability is managed by public status of project and assignement. // For external user, no check is done on company permission because readability is managed by public status of project and assignement.
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user; if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user;
if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1); if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $search_budget_amount, 1); if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $search_budget_amount, 1);
// Add where from extra fields // Add where from extra fields
@ -368,7 +369,7 @@ if ($search_status >= 0) $param.='&search_status='.$search_status;
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status);
if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent);
if ($search_public != '') $param.='&search_public='.$search_public; if ($search_public != '') $param.='&search_public='.$search_public;
if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_project_user != '') $param.='&search_project_user='.$search_project_user;
if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_sale > 0) $param.='&search_sale='.$search_sale;
if ($search_opp_amount != '') $param.='&search_opp_amount='.$search_opp_amount; if ($search_opp_amount != '') $param.='&search_opp_amount='.$search_opp_amount;
if ($search_budget_amount != '') $param.='&search_budget_amount='.$search_budget_amount; if ($search_budget_amount != '') $param.='&search_budget_amount='.$search_budget_amount;
@ -381,9 +382,6 @@ foreach ($search_array_options as $key => $val)
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
$text=$langs->trans("Projects");
if ($search_user == $user->id) $text=$langs->trans('MyProjects');
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -394,10 +392,10 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
// Show description of content // Show description of content
if ($search_user == $user->id) print $langs->trans("MyProjectsDesc").'<br><br>'; if ($search_project_user == $user->id) print $langs->trans("MyProjectsDesc").'<br><br>';
else else
{ {
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'<br><br>'; if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'<br><br>';
@ -417,7 +415,7 @@ if (! empty($conf->categorie->enabled))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$langs->trans('ProjectCategories'). ': ';
$moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1); $moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1);
$moreforfilter.='</div>'; $moreforfilter.='</div>';
} }
@ -427,7 +425,7 @@ $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
$includeonly=''; $includeonly='';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
// If the user can view thirdparties other than his' // If the user can view thirdparties other than his'

View File

@ -37,6 +37,7 @@ $langs->load('companies');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$search_all=GETPOST('search_all'); $search_all=GETPOST('search_all');
$search_categ=GETPOST("search_categ",'alpha');
$search_project=GETPOST('search_project'); $search_project=GETPOST('search_project');
if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus']))
{ {
@ -142,9 +143,10 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || 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")) // All tests are required to be compatible with all browsers
{ {
$search_all=""; $search_all="";
$search_categ="";
$search_project=""; $search_project="";
$search_projectstatus=-1; $search_projectstatus=-1;
$search_project_ref=""; $search_project_ref="";
@ -184,7 +186,7 @@ if ($search_project_user > 0) $puser->fetch($search_project_user);
if ($search_task_user > 0) $tuser->fetch($search_task_user); if ($search_task_user > 0) $tuser->fetch($search_task_user);
$title=$langs->trans("Activities"); $title=$langs->trans("Activities");
if ($search_task_user == $user->id) $title=$langs->trans("MyActivities"); //if ($search_task_user == $user->id) $title=$langs->trans("MyActivities");
if ($id) if ($id)
{ {
@ -232,6 +234,8 @@ $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title
$sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", s.nom as name, s.rowid as socid";
$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; $sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update";
$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; $sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut";
// We'll need these fields in order to filter by categ
if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project";
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks // Add fields from hooks
@ -239,8 +243,10 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
$sql.= " ".MAIN_DB_PREFIX."projet_task as t"; // We'll need this table joined to the select in order to filter by categ
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)";
if ($search_project_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; if ($search_project_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
if ($search_task_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ect"; if ($search_task_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ect";
@ -249,6 +255,8 @@ $sql.= " AND p.entity IN (".getEntity('project',1).')';
if (! $user->rights->projet->all->lire) $sql.=" AND p.rowid IN (".($projectsListId?$projectsListId:'0').")"; // public and assigned to projects, or restricted to company for external users if (! $user->rights->projet->all->lire) $sql.=" AND p.rowid IN (".($projectsListId?$projectsListId:'0').")"; // public and assigned to projects, 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 company, 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) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
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_project_ref) $sql .= natural_search('p.ref', $search_project_ref); if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref);
if ($search_project_title) $sql .= natural_search('p.title', $search_project_title); if ($search_project_title) $sql .= natural_search('p.title', $search_project_title);
if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref); if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref);
@ -359,7 +367,7 @@ if ($search_societe != '') $param.='&search_societe='.$search_societe;
if ($search_projectstatus != '') $param.='&search_projectstatus='.$search_projectstatus; if ($search_projectstatus != '') $param.='&search_projectstatus='.$search_projectstatus;
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status);
if ($search_public != '') $param.='&search_public='.$search_public; if ($search_public != '') $param.='&search_public='.$search_public;
if ($search_project_user > 0) $param.='&search_project_user='.$search_project_user; if ($search_project_user != '') $param.='&search_project_user='.$search_project_user;
if ($search_task_user > 0) $param.='&search_task_user='.$search_task_user; if ($search_task_user > 0) $param.='&search_task_user='.$search_task_user;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields // Add $param from extra fields
@ -395,12 +403,24 @@ if ($search_all)
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
} }
$morehtmlfilter = '';
// Filter on categories
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectCategories'). ': ';
$moreforfilter.=$formother->select_categories('project',$search_categ,'search_categ',1);
$moreforfilter.='</div>';
}
// If the user can view users // If the user can view users
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' ';
$includeonly=''; $includeonly='';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300'); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
// If the user can view users // If the user can view users

View File

@ -425,6 +425,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1);
} }
print '<div class="fichecenter">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$param=($withproject?'&withproject=1':''); $param=($withproject?'&withproject=1':'');
@ -492,7 +493,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
} }
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -268,7 +268,7 @@ input.select2-input {
border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */ border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */
} }
.liste_titre input[name=month], .liste_titre input[name=month_lim] { .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim] {
margin-right: 4px; margin-right: 4px;
} }
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
@ -282,9 +282,14 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
} }
input { input {
line-height: 17px; line-height: 17px;
padding: 4px;
padding-left: 5px;
}
select {
padding: 4px;
padding-left: 2px;
} }
input, select { input, select {
padding: 4px;
margin-left:0px; margin-left:0px;
margin-bottom:1px; margin-bottom:1px;
margin-top:1px; margin-top:1px;
@ -4003,7 +4008,7 @@ a span.select2-chosen
} }
.select2-container .select2-choice { .select2-container .select2-choice {
background-image: none; background-image: none;
line-height: 24px; /* line-height: 24px; */
} }
.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit .select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit
{ {

View File

@ -292,18 +292,24 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
outline: none; outline: none;
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
input, select {
border-bottom: solid 1px rgba(0,0,0,.1);
input {
line-height: 17px;
padding: 4px;
padding-left: 5px;
}
select {
padding: 4px;
padding-left: 2px;
}
input, select {
margin-left:0px; margin-left:0px;
margin-bottom:1px; margin-bottom:1px;
margin-top:1px; margin-top:1px;
} }
input {
padding:4px; input, select {
} border-bottom: solid 1px rgba(0,0,0,.1);
select {
padding:1px;
} }
textarea { textarea {