View Issue Details

IDProjectCategoryView StatusLast Update
0016999mantisbtotherpublic2014-02-19 11:57
ReporterDavid M Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version1.2.15 
Summary0016999: In the category API, category_get_id_by_name() ignores categories common to all projects.
Description

Whenever a project_id is involved, the value 0 is used to indicate "all projects" (for example when filtering bugs). So, when checking for all categories of a project, the query should check "project_id = <requested value> or project_value = 0".
However, in the category_api.php file, line 565, the function category_get_id_by_name() only checks for the project_id given in parameter, which triggers an error (or returns false) when the function is called on a category common to all projects, despite being logically available.

It can be avoided by a call along these lines:
$id = category_get_id_by_name($name, $project_id, false);
if (!$id) {
$id = category_get_id_by_name($name, 0);
}

But I believe this isn't the intended behaviour.

Steps To Reproduce

1- Check for a category available to "all projects" and an existing project's id.
2- Make a script calling category_get_id_by_name for the selected category and project.
3- The script ends with an error despite the category being available to the project.

Additional Information

Given the generic nature of the issue, it can be assumed that it will be found in other functions of the API. I unfortunately can't go and browse every one of them at the moment as I'm in crunch time, however I may report other issues of this kind as I come across them while I complete my project.

TagsNo tags attached.

Activities

There are no notes attached to this issue.