- New: Add filter on project status into task list. By default, only

"opened" project are visible.
- New: Status "validated" for project are renamed into "opened".
This commit is contained in:
Laurent Destailleur 2014-03-11 09:43:26 +01:00
parent 38423b9ec9
commit c9edced656
5 changed files with 39 additions and 21 deletions

View File

@ -25,11 +25,13 @@ For users:
- New: Increase length of url into bookmark module. - New: Increase length of url into bookmark module.
- New: Add an admin page to make a mass init of barcode values for all products. - New: Add an admin page to make a mass init of barcode values for all products.
- New: Automatic events for sending mails showing info about mail linked objects. - New: Automatic events for sending mails showing info about mail linked objects.
- New: Price management enhancement (multiprice level, price by customer, if MAIN_FEATURES_LEVEL=2 Price by qty) - New: Price management enhancement (multiprice level, price by customer, if MAIN_FEATURES_LEVEL=2 Price by qty).
- New: Add filter on text and status into survey list. Can also sorter on id, text and date end. - New: Add filter on text and status into survey list. Can also sorter on id, text and date end.
- New: Add option MAIN_FAVICON_URL - New: Add option MAIN_FAVICON_URL.
- Fix: Project Task numbering rule customs rule works - New: Created {line_price_ht_locale}, {line_price_vat_locale} and {line_price_ttc_locale} ODT tags.
- New: Created {line_price_ht_locale}, {line_price_vat_locale} and {line_price_ttc_locale} ODT tags - New: Add filter on project status into task list. By default, only "opened" project are visible.
- New: Status "validated" for project are renamed into "opened".
- Fix: Project Task numbering customs rule works.
TODO TODO
- New: Predefined product and free product use same form. - New: Predefined product and free product use same form.

View File

@ -288,8 +288,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Project // Project
if ($showproject) if ($showproject)
{ {
// Project ref
print "<td>"; print "<td>";
//var_dump($taskrole);
if ($showlineingray) print '<i>'; if ($showlineingray) print '<i>';
$projectstatic->id=$lines[$i]->fk_project; $projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
@ -298,6 +298,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
else print $projectstatic->getNomUrl(1,'nolink'); else print $projectstatic->getNomUrl(1,'nolink');
if ($showlineingray) print '</i>'; if ($showlineingray) print '</i>';
print "</td>"; print "</td>";
// Status
print '<td>';
$projectstatic->statut=$lines[$i]->projectstatus;
print $projectstatic->getLibStatut(2);
print "</td>";
} }
// Ref of task // Ref of task
@ -398,7 +404,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
{ {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="liste_total">'.$langs->trans("Total").'</td>'; print '<td class="liste_total">'.$langs->trans("Total").'</td>';
if ($showproject) print '<td></td>'; if ($showproject) print '<td></td><td></td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';

View File

@ -65,8 +65,8 @@ class Project extends CommonObject
$this->db = $db; $this->db = $db;
$this->societe = new Societe($db); $this->societe = new Societe($db);
$this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); $this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
$this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); $this->statuts = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
} }
/** /**

View File

@ -535,9 +535,10 @@ class Task extends CommonObject
* @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
* @param string $filteronprojref Filter on project ref * @param string $filteronprojref Filter on project ref
* @param string $filteronprojstatus Filter on project status
* @return array Array of tasks * @return array Array of tasks
*/ */
function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $filteronprojref='') function getTasksArray($usert=0, $userp=0, $projectid=0, $socid=0, $mode=0, $filteronprojref='', $filteronprojstatus=-1)
{ {
global $conf; global $conf;
@ -546,7 +547,7 @@ class Task extends CommonObject
//print $usert.'-'.$userp.'-'.$projectid.'-'.$socid.'-'.$mode.'<br>'; //print $usert.'-'.$userp.'-'.$projectid.'-'.$socid.'-'.$mode.'<br>';
// List of tasks (does not care about permissions. Filtering will be done later) // List of tasks (does not care about permissions. Filtering will be done later)
$sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel, p.public,"; $sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut,";
$sql.= " t.rowid as taskid, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress,"; $sql.= " t.rowid as taskid, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress,";
$sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.ref as ref_task,t.rang"; $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.ref as ref_task,t.rang";
if ($mode == 0) if ($mode == 0)
@ -567,6 +568,7 @@ class Task extends CommonObject
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")"; if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
} }
if ($filteronprojref) $sql.= " AND p.ref LIKE '%".$filteronprojref."%'"; if ($filteronprojref) $sql.= " AND p.ref LIKE '%".$filteronprojref."%'";
if ($filteronprojstatus > -1) $sql.= " AND p.fk_statut = ".$filteronprojstatus;
$sql.= " ORDER BY p.ref, t.rang, t.dateo"; $sql.= " ORDER BY p.ref, t.rang, t.dateo";
//print $sql; //print $sql;
@ -606,6 +608,7 @@ class Task extends CommonObject
$tasks[$i]->fk_project = $obj->projectid; $tasks[$i]->fk_project = $obj->projectid;
$tasks[$i]->projectref = $obj->ref; $tasks[$i]->projectref = $obj->ref;
$tasks[$i]->projectlabel = $obj->plabel; $tasks[$i]->projectlabel = $obj->plabel;
$tasks[$i]->projectstatus = $obj->fk_statut;
$tasks[$i]->label = $obj->label; $tasks[$i]->label = $obj->label;
$tasks[$i]->description = $obj->description; $tasks[$i]->description = $obj->description;
$tasks[$i]->fk_parent = $obj->fk_task_parent; $tasks[$i]->fk_parent = $obj->fk_task_parent;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2010 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -34,6 +34,8 @@ $langs->load('users');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$search_project=GETPOST('search_project'); $search_project=GETPOST('search_project');
if (! isset($_GET['search_status']) && ! isset($_POST['search_status'])) $search_status=1;
else $search_status=GETPOST('search_status');
// Security check // Security check
@ -85,17 +87,17 @@ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$so
// 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 can have a parent that is not affected to him). // 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).
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project); $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status);
// 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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="mode" value="'.GETPOST('mode').'">'; 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>'.$langs->trans("Status").'</td>';
print '<td width="80">'.$langs->trans("RefTask").'</td>'; print '<td width="80">'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="center">'.$langs->trans("DateStart").'</td>'; print '<td align="center">'.$langs->trans("DateStart").'</td>';
@ -113,6 +115,11 @@ print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_project" value="'.$search_project.'" size="8">'; print '<input type="text" class="flat" name="search_project" value="'.$search_project.'" size="8">';
print '</td>'; print '</td>';
print '<td class="liste_titre">';
$listofstatus=array(-1=>'&nbsp;');
foreach($projectstatic->statuts_short as $key => $val) $listofstatus[$key]=$langs->trans($val);
print $form->selectarray('search_status', $listofstatus, $search_status);
print '</td>';
print '<td class="liste_titre" colspan="7">'; print '<td class="liste_titre" colspan="7">';
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';