• Status Closed
  • Percent Complete
  • Task Type Feature Request
  • Category Backend/Core
  • Assigned To No-one
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Flyspray
Opened by phil - 14.08.2007
Last edited by Floele - 21.08.2007

FS#1330 - Categories tasklist column

I've kludged (in a change that allows categories to be seen in the tasklist. Right now we can see category, but we do not see its possible parent categories. This can be highly useful, depending on the situation.

The approach is to pre-calculate the categories string into a new column in the list_category table during the update of a category in (this means that a "dumb" update must be forced after adding a new category)

Another approach might be somehow generating such a categories string on the fly in class.backend.php in the get_task_list() function, but my brain exploded when I attempted to concoct the SQL :p

The files I kludged are:
includes/ – actual kludge: precalc the string
after case 'update_category'
after $listowners

$phil_kludge = $db→FetchAllArray(

                      $db->Query('SELECT * FROM {list_category} WHERE project_id = ? order by lft', $proj->id)

$phil_temp_r = $phil_temp_pr = 9999; should be max(rgt)
$phil_temp_l = 0;
$phil_parent = array();
$phil_temp_c = '';
foreach ($phil_kludge as $phil_i ⇒ $phil_row) if ($phil_i > 0)
skip root

                      if ($phil_temp_r > $phil_row['rgt'])
                              if ($phil_temp_c) $phil_parent[] = $phil_temp_c;
                              $phil_temp_pr = $phil_temp_r;
                      else if ($phil_temp_pr < $phil_row['rgt'])
                      // this if clause should be simplified
                      if (count($phil_parent) > 0) $listfullname[$phil_row['category_id']] =
                              implode(' - ',$phil_parent).' - '.$phil_row['category_name'];
                      else $listfullname[$phil_row['category_id']] =
                      $phil_temp_r = $phil_row['rgt'];
                      $phil_temp_c = $phil_row['category_name'];

END THIS KLUDGE, more below
and then modify the $update string below accordingly to add one new column
includes/class.backend.php – bookkeeping: load the precalced string in get_task_list
the 'allcat' is probably superfluous, as the old category search is inclusive?
if (array_get($args, 'allcat') || in_array('categories', $visible)) {
$from .= ' LEFT JOIN {list_category} lc2 ON t.product_category = lc2.category_id ';
$select .= ' lc2.category_full_name AS category_full_name, ';
$groupby .= 'lc2.category_full_name, ';
dont forget to add to $order_keys later in the func
scripts/index.php – add to $indexes in tpl_draw_cell()
templates/pm.prefs.tpl – add to $columnnames

other files possibly needing modify:
includes/ – to further integrate it into "add a new category" code
?/setup.php* – to implement the database change into setup/migrate/etc script

Closed by  Floele
21.08.2007 17:55
Reason for closing:  Will Not Implement
phil commented on 14.08.2007 18:04

Pooh, the formatting got screwed up a little bit


That uses too much width in the task list column I'd say. For 1.0 there will be a somewhat more useful sorting though, so that tasks are sorted keeping the hierarchy.

 -         -              v
ID 1    Summary 1    Root Category 1
ID 2    Summary 2    Sub Category 1
ID 3    Summary 3    Sub Category 2
ID 4    Summary 4    Root Category 2
ID 5    Summary 5    Sub Category 1


Available keyboard shortcuts


Task Details

Task Editing