New: [ task #285 ] Add search filter on project in tasks list.
This commit is contained in:
parent
0b71aceb90
commit
99d740fd2f
@ -53,6 +53,7 @@ For users:
|
|||||||
- New: Default output charset are utf8 into backup tool.
|
- New: Default output charset are utf8 into backup tool.
|
||||||
- New: Add brazilian states.
|
- New: Add brazilian states.
|
||||||
- New: Increase usability of module project.
|
- New: Increase usability of module project.
|
||||||
|
- New: [ task #285 ] Add search filter on project in tasks list.
|
||||||
- New: Automatic list of documents in ECM module is ok for customers,
|
- New: Automatic list of documents in ECM module is ok for customers,
|
||||||
suppliers invoice, orders, customers orders, proposals and social contributions.
|
suppliers invoice, orders, customers orders, proposals and social contributions.
|
||||||
- New: All professional id can contains up to 128 chars instead of 32.
|
- New: All professional id can contains up to 128 chars instead of 32.
|
||||||
|
|||||||
@ -843,11 +843,11 @@ class Project extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return array of projects a user has permission on, is affected to, or all projects
|
* Return array of projects a user has permission on, is affected to, or all projects
|
||||||
*
|
*
|
||||||
* @param User $user User object
|
* @param User $user User object
|
||||||
* @param int $mode 0=All project I have permission on, 1=Projects affected to me only, 2=Will return list of all projects with no test on contacts
|
* @param int $mode 0=All project I have permission on, 1=Projects affected to me only, 2=Will return list of all projects with no test on contacts
|
||||||
* @param int $list 0=Return array,1=Return string list
|
* @param int $list 0=Return array,1=Return string list
|
||||||
* @param int $socid 0=No filter on third party, id of third party
|
* @param int $socid 0=No filter on third party, id of third party
|
||||||
* @return array Array of projects
|
* @return array Array of projects
|
||||||
*/
|
*/
|
||||||
function getProjectsAuthorizedForUser($user, $mode=0, $list=0, $socid=0)
|
function getProjectsAuthorizedForUser($user, $mode=0, $list=0, $socid=0)
|
||||||
{
|
{
|
||||||
@ -864,11 +864,9 @@ class Project extends CommonObject
|
|||||||
$sql.= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
|
$sql.= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
|
||||||
}
|
}
|
||||||
$sql.= " WHERE p.entity = " . $conf->entity;
|
$sql.= " WHERE p.entity = " . $conf->entity;
|
||||||
|
|
||||||
// Internal users must see project he is contact to even if project linked to a third party he can't see.
|
// Internal users must see project he is contact to even if project linked to a third party he can't see.
|
||||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||||
if ($socid)
|
if ($socid > 0) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";
|
||||||
$sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";
|
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -458,14 +458,15 @@ class Task extends CommonObject
|
|||||||
* Return list of tasks for all projects or for one particular project
|
* Return list of tasks for all projects or for one particular project
|
||||||
* Sort order is on project, TODO then of position of task, and last on title of first level task
|
* Sort order is on project, TODO then of position of task, and last on title of first level task
|
||||||
*
|
*
|
||||||
* @param User $usert Object user to limit tasks affected to a particular user
|
* @param User $usert Object user to limit tasks affected to a particular user
|
||||||
* @param User $userp Object user to limit projects of a particular user and public projects
|
* @param User $userp Object user to limit projects of a particular user and public projects
|
||||||
* @param int $projectid Project id
|
* @param int $projectid Project id
|
||||||
* @param int $socid Third party id
|
* @param int $socid Third party id
|
||||||
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
|
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
|
||||||
* @return array Array of tasks
|
* @param string $filteronprojref Filter on project ref
|
||||||
|
* @return array Array of tasks
|
||||||
*/
|
*/
|
||||||
function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0)
|
function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $filteronprojref='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -494,6 +495,7 @@ class Task extends CommonObject
|
|||||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||||
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
|
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
|
||||||
}
|
}
|
||||||
|
if ($filteronprojref) $sql.= " AND p.ref LIKE '%".$filteronprojref."%'";
|
||||||
$sql.= " ORDER BY p.ref, t.label";
|
$sql.= " ORDER BY p.ref, t.label";
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|||||||
@ -55,16 +55,21 @@ $pagenext = $page + 1;
|
|||||||
|
|
||||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||||
|
|
||||||
|
$search_ref=GETPOST("search_ref");
|
||||||
|
$search_label=GETPOST("search_label");
|
||||||
|
$search_societe=GETPOST("search_societe");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
|
||||||
|
|
||||||
$projectstatic = new Project($db);
|
$projectstatic = new Project($db);
|
||||||
$socstatic = new Societe($db);
|
$socstatic = new Societe($db);
|
||||||
|
|
||||||
|
llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
||||||
|
|
||||||
|
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1,$socid);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1,$socid);
|
||||||
|
|
||||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat";
|
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat";
|
||||||
@ -79,15 +84,15 @@ if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$pro
|
|||||||
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 ($_GET["search_ref"])
|
if ($_GET["search_ref"])
|
||||||
{
|
{
|
||||||
$sql.= " AND p.ref LIKE '%".$db->escape($_GET["search_ref"])."%'";
|
$sql.= " AND p.ref LIKE '%".$db->escape($search_ref)."%'";
|
||||||
}
|
}
|
||||||
if ($_GET["search_label"])
|
if ($_GET["search_label"])
|
||||||
{
|
{
|
||||||
$sql.= " AND p.title LIKE '%".$db->escape($_GET["search_label"])."%'";
|
$sql.= " AND p.title LIKE '%".$db->escape($search_label)."%'";
|
||||||
}
|
}
|
||||||
if ($_GET["search_societe"])
|
if ($_GET["search_societe"])
|
||||||
{
|
{
|
||||||
$sql.= " AND s.nom LIKE '%".$db->escape($_GET["search_societe"])."%'";
|
$sql.= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
|
||||||
}
|
}
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
@ -111,6 +116,8 @@ if ($resql)
|
|||||||
else print $langs->trans("ProjectsPublicDesc").'<br><br>';
|
else print $langs->trans("ProjectsPublicDesc").'<br><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
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"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder);
|
||||||
@ -120,16 +127,15 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<form method="get" action="liste.php">';
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre"valign="right">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'" size="6">';
|
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="6">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"valign="right">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_label" value="'.$_GET["search_label"].'">';
|
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"valign="right">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_societe" value="'.$_GET["search_societe"].'">';
|
print '<input type="text" class="flat" name="search_societe" value="'.$search_societe.'">';
|
||||||
print '</td>';
|
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" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
|
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
|
||||||
|
|||||||
@ -33,6 +33,8 @@ $langs->load('projects');
|
|||||||
$langs->load('users');
|
$langs->load('users');
|
||||||
|
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
|
$search_product=GETPOST('search_product');
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
@ -48,6 +50,7 @@ $page = $page == -1 ? 0 : $page;
|
|||||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -79,14 +82,18 @@ else
|
|||||||
|
|
||||||
// Get list of project id allowed to user
|
// Get list of project id allowed to user
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||||
|
|
||||||
// Get list of tasks in tasksarray and taskarrayfiltered
|
// Get list of tasks in tasksarray and taskarrayfiltered
|
||||||
// We need all tasks (even not limited to a user because a task to user
|
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
|
||||||
// can have a parent that is not affected to him).
|
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_product);
|
||||||
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0);
|
|
||||||
// We load also tasks limited to a particular user
|
// We load also tasks limited to a particular user
|
||||||
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
|
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
|
||||||
|
|
||||||
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.GETPOST('mode').'">';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Project").'</td>';
|
print '<td>'.$langs->trans("Project").'</td>';
|
||||||
print '<td width="80">'.$langs->trans("RefTask").'</td>';
|
print '<td width="80">'.$langs->trans("RefTask").'</td>';
|
||||||
@ -96,11 +103,24 @@ print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
|||||||
print '<td align="right">'.$langs->trans("Progress").'</td>';
|
print '<td align="right">'.$langs->trans("Progress").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input type="text" class="flat" name="search_product" value="'.$search_product.'" size="8">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" colspan="5">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
// Show all lines in taskarray (recursive function to go down on tree)
|
// Show all lines in taskarray (recursive function to go down on tree)
|
||||||
$j=0; $level=0;
|
$j=0; $level=0;
|
||||||
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId);
|
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId);
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user