I have the tasklist module installed and its working great, except when I'm on the main task list node and I change the filter by selecting completed or all from the drop down box and then "filter" it just goes back to uncompleted tasks view. I can't see the others.

Anyone have any idea what I'm doing wrong?

Thanks

Comments

Carlos Miranda Levy’s picture

I experienced the same problem on a fresh 4.7 installation.
I tried both the 4.7 and the CVS version.

Since I'm pressed for time and all I want is to list all tasks (completed or not), I looked for the code that builds the task lists for display and simply commented out the condition statements so that the filter displays all tasks regardless of the selection.

That is, go to line 330 where it says:
// Filter the tasks shown

and comment the following:

if ($_POST['edit']['filter'] == 0) {
      // incomplete tasks
      $complete = 'AND t.completed = 0';
      $order_by = 't.order_by';
    } 
    elseif ($_POST['edit']['filter'] == 1) {
      // complete tasks
      $complete = 'AND t.completed > 0';
      $order_by = 't.completed DESC';
    } 
    else {
      // all tasks
      $order_by = 'IF(t.completed = 0, 0, 1), t.completed DESC, t.order_by';
    }

by adding /* before and */ after it. Then simply copy and paste the last statement below:
$order_by = 'IF(t.completed = 0, 0, 1), t.completed DESC, t.order_by'; so that it ends up like this:

    // Filter the tasks shown
/*
    if ($_POST['edit']['filter'] == 0) {
      // incomplete tasks
      $complete = 'AND t.completed = 0';
      $order_by = 't.order_by';
    } 
    elseif ($_POST['edit']['filter'] == 1) {
      // complete tasks
      $complete = 'AND t.completed > 0';
      $order_by = 't.completed DESC';
    } 
    else {
      // all tasks
      $order_by = 'IF(t.completed = 0, 0, 1), t.completed DESC, t.order_by';
    }
*/
      $order_by = 'IF(t.completed = 0, 0, 1), t.completed DESC, t.order_by';

For the sake of minimizing confusion (remember, we haven't fixed the problem of the filter not being applied), do the following so that the filter shows 'All Tasks' as selected:

Go to around line 360 where it says:
'#default_value' => 0,

and change the 0 (Incomplete Tasks) with a -1 (All tasks):
'#default_value' => -1,

This doesn't solve the problem of the selection not being applied, but at least it gets you to list all tasks, Complete and Incomplete, regardless of the selection, which is what I needed now.

And if it really bothers you that the other options are listed (Completed/Incomplete), then just change the line after last one:
'#options' => array(0=>t('Incomplete Tasks'),1=>t('Complete Tasks'),-1=>t('All Tasks'))

into:
'#options' => array(-1=>t('All Tasks'))

Then the only filter option will be 'All Tasks' and users will at most think it's an odd design and not a bug.

By the way, this should be listed as an issue on the Tasklist module's page. I just did:
http://drupal.org/node/44293

------
Con paciencia y calma,
sube un burro a una palma

worthy’s picture

That is exactly what I needed to do and you wrote it out simply enough that even this total newbie could get it fixed, well working anyways.

Thank you!

wmswms’s picture

Ive written a patch that makes it work like it should. Its on the issues tracker:

http://drupal.org/node/64157