[horde] Is this a bug in nag api.php?

Jan Schneider jan at horde.org
Sun Apr 18 12:13:23 UTC 2010


Zitat von Monty Hall <hall_monty at rastar.merseine.nu>:

> I'm trying to get hermes to ignore completed tasks in nag.  Hermes,  
> does in fact make a request for incomplete tasks via  
> hermes/lib/Forms/Time.php:
>
>    $criteria = array('user'   => Auth::getAuth(),  'active' => true)
>
> However in the nag/lib/api.php, the list tasks, ignores the  
> criteria, is this correct? In fact, it doesn't even look @ the  
> criteria.
>
> Making the following changes appear to work:
>
>    while ($task = $tasks->each()) {
>        if ($task->completed)
>            continue;
>
>
> However, I have no idea what side effects I just introduced. :(
>
>
> Monty
>
>
> ====== nag/api.php======
> /**
> * Lists active tasks as cost objects.
> *          * @todo Implement $criteria parameter.
> *
> * @param array $criteria   Filter attributes
> */
> function _nag_listCostObjects($criteria)
> {
>    require_once dirname(__FILE__) . '/base.php';
>
>    $tasks = Nag::listTasks(null, null, null, null, 1);
>    $result = array();
>    $tasks->reset();
>    while ($task = $tasks->each()) {
>
>        $result[$task->id] = array('id' => $task->id,
>                                   'active' => !$task->completed,
>                                   'name' => $task->name);
>        if (!empty($task->estimate)) {
>            $result[$task->id]['estimate'] = $task->estimate;
>        }
>    }
>      if (count($result) == 0) {
>        return array();
>    } else {
>        return array(array('category' => _("Tasks"),
>                           'objects'  => array_values($result)));
>    }
> }

This is the expected behavior.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the horde mailing list