[#5472] Unable to delete tasks (Nag H3 (2.2-cvs))
Summary Unable to delete tasks (Nag H3 (2.2-cvs))
Queue Nag
Queue Version HEAD
Type Bug
State Resolved
Priority 2. Medium
Owners Chuck Hagenbuch <chuck (at) horde (dot) org>
Requester kaosbunny (at) gmail (dot) com
Created 06/18/2007 (382 days ago)
Due
Updated 06/18/2007 (382 days ago)
Assigned
Resolved 06/18/2007 (382 days ago)
Attachments
Milestone
Patch No

History
06/18/2007 Chuck Hagenbuch Comment #2
State ⇒ Resolved
Assigned to Chuck Hagenbuch
Reply to this comment
Fixed in CVS. Thanks for the detail about having only one tasklist.
06/18/2007 kaosbunny (at) gmail (dot) com Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Type ⇒ Bug
Summary ⇒ Unable to delete tasks (Nag H3 (2.2-cvs))
Queue ⇒ Nag
Reply to this comment
When I try to delete a task I get the error:

Fatal error: Cannot use object of type PEAR_Error as array in 
/usr/share/colab/horde/nag/task.php on line 21

It seems that the $tasklist_id argument passed to _delete() is NULL 
(which comes from the $vars->get('old_tasklist')) when it should be 
set to my userid and makes the Nag::GetTask() to fail.

I have managed to isolate it to line 63 in /horde/nag/lib/Forms/task.php:

             count($tasklists) > 1) {

which I basically interpret as "only do this if there are more than 
one tasklists".
However, it seems to be necessary to do $vars->set('old_tasklist'); 
even with only one tasklist, so changing it to

             count($tasklists) > 0) {

solved the problem. (As would deleting that condition alltogether I suppose.)

My personal reflection would be that the idea was to only use 
old_tasklist if there is a chance of confusing which tasklist owned 
the task (i.e. when having multiple tasklists), but it is however used 
"blindly" in the _delete() function in horde/nag/task.php.

So when this is done with a user with multiple tasklists, no error is 
ever encountered.