Importing bug data from another source: improving bug_create

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
dtgriscom
Posts: 9
Joined: 31 Jul 2005, 02:23
Location: Melrose, MA

Importing bug data from another source: improving bug_create

Post by dtgriscom »

I'm working on building a tool to import bug data from another product. I've seen the importer code described at http://www.mantisbt.org/mantis/view.php?id=4220, but it's not flexible enough for my needs, so I'm rolling my own (I'll post about it here if I think the results are generally useful).

One item I'd like to import would be the bug status and resolution, but there's a barrier in the main Mantis code to doing this. Currently, the primary bug creation function bug_create($p_bug_data) in core/bug_api.php takes a BugData object and builds the bug from that. The BugData object includes status (default NEW_) and resolution (default OPEN) fields, which is great. However, bug_create() ignores the values in the argument BugData object, figuring out the values for itself.

I'd like to suggest three changes:

1: Have the default BugData->status value be set to 0 (or some other never-used value). This would be interpreted as "not specified" in functions that take a BugData as an argument.

2: Have bug_create() check the value of $p_bug_data->status. If the status == 0 then it can build the new bug's status value as it currently does (including setting the handler_id if appropriate). However, if the argument's status != 0, then bug_create() should use that status, and do no checks for auto-assigning the bug.

3: Have bug_create() use the value of $p_bug_data->resolution as-is.

So, my questions:

a) Does this make sense as a change to the main Mantis code-base?

b) If so, should I submit this as a patch to bug_api.php (built from the most recent CVS version)?


Thanks,
Dan
Post Reply