Enumerating Custom Fields with version specific to a project

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
modest
Posts: 46
Joined: 11 Apr 2011, 18:27

Enumerating Custom Fields with version specific to a project

Post by modest »

So right now, Mantis supports enumerating custom fields with dynamic values defined in the current project (or the project to which the issue belongs)
http://docs.mantisbt.org/master/en/admi ... DS.DYNAMIC

However, I would like to always enumerate my custom field with version values for a specific project. For example, enumerate the custom field "Firmware version" with a list of versions defined for a project named "Firmware" in the MantisBT.

Based on the example code (replaced "categories" with "versions") given in the above link:

Code: Select all

    $t_versions = versions_get_all_rows( helper_get_current_project() );
the "helper_get_current_project" function gets the name of the project, is there a similar function to which we can pass the name of the specific project from which we would like to pull the version values?
atrol
Site Admin
Posts: 8536
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Enumerating Custom Fields with version specific to a pro

Post by atrol »

Have a look at function project_get_id_by_name in file core/project_api.php
Please use Search before posting and read the Manual
modest
Posts: 46
Joined: 11 Apr 2011, 18:27

Re: Enumerating Custom Fields with version specific to a pro

Post by modest »

atrol wrote:Have a look at function project_get_id_by_name in file core/project_api.php
Thanks. I was able to get it to work using your tip. So it seems that if I want two of my custom enumeration field to populate the version list from two different projects I simply add another custom function like:

Code: Select all

function custom_function_override_enum_versions_2 (){
...
...
}
and specify "=versions_2" in the Manage->Manage Custom fields->MyCustomField2.

In fact I have been able to do it successfully, but just wanted to make sure that I did it in a correct fashion.
Post Reply