View Issue Details

IDProjectCategoryView StatusLast Update
0005668mantisbtsub-projectspublic2015-05-21 12:47
Reporterpolzin Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status acknowledgedResolutionopen 
Summary0005668: "versions" of parent project should be used in subprojects.
Description

I would like to simplify the management of several projects that have the same "version" by assigning them to the same parent project. Then the "version" for the filters and for drop-down boxes could use the version numbers of the parent project.

Issue 0005599, which is said to be fixed, claims to implement such a thing (at least in my understanding), but it does not do it.

It would also be usedful if project-categories can be configured in the same centralised way.

Additional Information

See also my other report 0005666 on duplicates when version numbers are used the other way around.

TagsNo tags attached.

Relationships

related to 0011624 closedjreese Updating version name in parent project does not update references in child projects 
has duplicate 0005669 closedthraxisp "versions" of parent project should be used in subprojects. 
has duplicate 0007272 closedvboctor Let Sub-Projects inherit the Versions 
has duplicate 0007942 closedvboctor Subprojects doesn't inherit versions 
has duplicate 0006147 closedvboctor Inheriting version to subprojects ? 
has duplicate 0010243 closedvboctor New Feature "Copy Versions to all Subprojects" 
has duplicate 0014265 closeddregad Cannot filter by Target Version or Fixed In Version over All Projects 
has duplicate 0016045 closeddregad Version list in bug action group menu 
related to 0010873 closeddregad Change Log/Roadmap do not work with inherited versions. 
related to 0012261 closedcproensa Cannot filter by versions of parent project when child project selected 
related to 0013147 new I really want true global versions (like global categories) 

Activities

Rudboy

Rudboy

2005-05-31 11:48

reporter   ~0010290

So, i'm too interested by this issue, because it's difficult to manage the version, if i want to add one or more versions in the Parent project,the children project aren't updated and i must do it manually.
Can we to copy version a project to an other (as the categories) or a parent project version is usable by her child.

polzin

polzin

2005-06-03 07:39

reporter   ~0010346

Last edited: 2006-05-23 07:23

Is there a chance, that is could be done? I had a quick look at it, but had the impression that there are to many places that have to be fixed such that it is not feasible for me to fix it myself.

Rudboy

Rudboy

2005-06-07 06:20

reporter   ~0010384

Anybody has an idea on this subject?

andreg

andreg

2005-09-02 11:08

reporter   ~0011339

I'd the same problem. I build a "quick&dirty" solution in the following way:

  1. add the following function to project_hierarchy_api.php:

    function project_hierarchy_get_parent_id( $p_project_id) {
    #$t_project_table = config_get( 'mantis_project_table' );
    $c_child_id = db_prepare_int( $p_project_id );
    $t_project_hierarchy_table = config_get( 'mantis_project_hierarchy_table' );
    $query = "SELECT child_id, parent_id
    FROM $t_project_hierarchy_table
    WHERE child_id=$c_child_id";
    $result = db_query( $query );
    if (db_num_rows( $result )>0) {
    $row = db_fetch_array( $result );
    return $row['parent_id'];
    } else {
    return -1;
    }

    }

  2. change the code in bug_change_status_page.php near "<!-- Fixed in Version -->":
    <select name="fixed_in_version">
    <?php print_version_option_list( bug_get_field( $f_bug_id, 'fixed_in_version' ),
    bug_get_field( $f_bug_id, 'project_id' ), VERSION_ALL ) ?>
    <?php $project_id=bug_get_field( $f_bug_id, 'project_id' );
    $parent_project_id=project_hierarchy_get_parent_id($project_id);
    if ($parent_project_id>-1) {
    print_version_option_list( bug_get_field( $f_bug_id, 'fixed_in_version' ),
    $parent_project_id, VERSION_ALL );
    }
    ?>

    &lt;/select>

Now the combobox on the ChangeStatusPage shows the version numbers of the parental project.
ToDo:

  • recursive looking for parents
  • remove the second empty item in the combobox.
polzin

polzin

2005-09-07 04:56

reporter   ~0011347

Thanks for the patch! For my problem, it should be sufficient, anyway it would be good for Mantis, if the usefulness of the project-hierachy would be extended in a consistent manner.

Possible issue with the patch: It is not checked, whether the parent project is visible for the user. (Which is good in my situation, as some users don´t "see" the parent project).

polzin

polzin

2005-09-19 08:26

reporter   ~0011392

Wouldn´t it be better to patch "print_version_option_list", because this will be used also on the bug report page?

I tried it and it seems to work, but perhaps anyone sees a problem with this...

polzin

polzin

2005-09-19 08:54

reporter   ~0011393

Oh, perhaps one should patch "version_get_all_rows", because this is used also on the changelog page...

andreg

andreg

2005-10-11 04:17

reporter   ~0011483

Ok, done. Perhaps it's better now. It seems to be a good idea to patch the "version_get_all_rows" function, because now the versions are also available in the project management. Now it's also recursive, I think.
So, I "patched" the following functions:

  1. again I added the "project_hierarchy_get_parent_id" to project_hierarchy_api.php:

    function project_hierarchy_get_parent_id( $p_project_id) {
    $c_child_id = db_prepare_int( $p_project_id );
    $t_project_hierarchy_table = config_get( 'mantis_project_hierarchy_table' );
    $query = "SELECT child_id, parent_id
    FROM $t_project_hierarchy_table
    WHERE child_id=$c_child_id";
    $result = db_query( $query );
    if (db_num_rows( $result )>0) {
    $row = db_fetch_array( $result );
    return $row['parent_id'];
    } else {
    return -1;
    }

    }

  2. but in difference to my first try, now I changed the end of the "version_get_all_rows" function in the follwing way (replace the last statement "return $rows;" by the code snippet):

$t_parent_id=project_hierarchy_get_parent_id($p_project_id);
if ($t_parent_id!=-1) {
$parent_rows=array();
$parent_rows=version_get_all_rows($t_parent_id);
for ($i=0;$i<count($parent_rows);$i++) {
$found=false;
for ($j=0;$j<count($rows);$j++) {
if ($rows[$j]['version']==$parent_rows[$i]['version']) {
$found=true;
break;
}
}
if (!$found) {
$rows[]=$parent_rows[$i];
}

}
$t_function = create_function( '$a, $b', 
         &quot;return strnatcasecmp( \$a['version'], \$b['version'] );&quot; );
uasort( $rows, $t_function );

}

return $rows;

The only open issue is the compliance with the user rights (is the project visible?). Maybe someone have an idea for solving it?

buus

buus

2007-01-17 20:22

reporter   ~0013933

Any word on when/if this fix will be added to the core?

buus

buus

2007-01-22 12:55

reporter   ~0013947

I've fixed two things with the patch:

  • Changed the sort order to be high-to-low, so the most recent version is always at the top of the list
  • Added $p_released to the call to version_get_all_rows so that the "non-released" versions don't appear when a user is reporting a bug

    $t_parent_id=project_hierarchy_get_parent_id($p_project_id);
    if ($t_parent_id!=-1) {
    $parent_rows=array();
    $parent_rows=version_get_all_rows($t_parent_id, $p_released);
    for ($i=0;$i<count($parent_rows);$i++) {
    $found=false;
    for ($j=0;$j<count($rows);$j++) {
    if ($rows[$j]['version']==$parent_rows[$i]['version']) {
    $found=true;
    break;
    }
    }
    if (!$found) {
    $rows[]=$parent_rows[$i];
    }

     }
     $t_function = create_function( '$a, $b',
             &quot;return strnatcasecmp( \$b['version'], \$a['version'] );&quot; );
     uasort( $rows, $t_function );
fizzy1236

fizzy1236

2007-02-07 18:42

reporter   ~0014012

I have added some more fixes so the change log shows sub-projects properly:

In core/version_api.php:

  • Allow the change log sub-projects to show parent versions with their changes

~line 344:
$query = "SELECT p.id
FROM $t_project_version_table p
LEFT OUTER JOIN mantis_project_hierarchy_table h ON h.child_id ='$c_project_id'
WHERE (p.project_id='$c_project_id' OR p.project_id=h.parent_id) AND
p.version='$c_version'";

changelog_page.php:

  • Sub-project revisions will show the sub-project name, not the parent project name(project owning the version)

    function print_version_header( $p_version_id, $t_project_name="" ) {
    $t_project_id = version_get_field( $p_version_id, 'project_id' );
    $t_version_name = version_get_field( $p_version_id, 'version' );
    if(empty($t_project_name)) {
    $t_project_name = project_get_field( $t_project_id, 'name' );
    }

    $t_release_title = $t_project_name . ' - ' . $t_version_name;
    echo $t_release_title, '<br />';
    echo str_pad( '', strlen( $t_release_title ), '=' ), '<br />';

    $t_description = version_get_field( $p_version_id, 'description' );
    if ( ( $t_description !== false ) && !is_blank( $t_description ) ) {
    echo string_display( "<br />$t_description<br /><br />" );
    }
    }

    Change any print_version_header calls you want to change this name for. I changed the first two calls in changelog_page, working from the top, to:

    print_version_header( $t_version_id, $t_project_name );

stb

stb

2007-03-30 13:04

reporter   ~0014292

Interested, too. Will this feature be available in official mantis?

W32

W32

2007-05-10 03:40

reporter   ~0014486

This is a very require feature for my. Will this one be available in 1.1.0 release ?

brody

brody

2007-05-24 05:29

reporter   ~0014627

I've an technical solution (idea) for that feature, I need, too:

The project_version_table could get an additional boolean column named "use_in_subproject". Thus versions could be managed in the head project and will be available in the subprojects. If subprojects need their own (additional) versions (this could be neccesarry in case of special patches) the subproject could add own version strings. They must be checked against the head project versions to not interfere with them.

<b>For issues</b> the versions are not linked, but the text is copied, so this does not interfere the process.

<b>For filters</b>: If I'm in the head project, only versions if the head are available for filtering. It might be useful to get a flag ("include sub versions"). If I'm inside a sub project all versions including the head project versions are available then.

emathieu

emathieu

2007-07-24 16:31

reporter   ~0015212

I also suggest this patch in core/version_api.php
in version_get_id
replace
return false;
with

Patch to handle version from parent

       $t_parent_id = project_hierarchy_get_parent_id( $p_project_id );
       if ( $t_parent_id != -1 ) {
           return version_get_id( $p_version, $t_parent_id );
     } else {

END

           return false;
     }
fizzy1236

fizzy1236

2007-07-27 17:22

reporter   ~0015246

I have a small change to andreg's last post. Instead of doing the comparison

$rows[$j]['version']==$parent_rows[$i]['version']

I suggest using

strcmp($rows[$j]['version'], $parent_rows[$i]['version']) == 0

We had a problem where it considered version 4.1 equal to 4.10. Making this change allowed both versions to show up.

mkornatzki

mkornatzki

2007-08-10 15:53

reporter   ~0015402

thank you all. the patch works fine for me.

if you put
$t_function = create_function( '$a, $b',
"return strnatcasecmp( \$b['version'], \$a['version'] );" );
uasort( $rows, $t_function );

out of the if statement you get the "original" version also sorted.

mkornatzki

mkornatzki

2007-09-25 14:30

reporter   ~0015711

if you change a version in a project the versions in the subprojects didn't get updated.

to fix this beaviour you have to edit the function version_update in core/versions.php

add $t_project_hierarchy_table = config_get( 'mantis_project_hierarchy_table' );
after $t_project_version_table = config_get( 'mantis_project_version_table' );

add #select for all project-ids (parent-project and all subprojects)
$project_id_query = "SELECT m2.child_id
FROM $t_project_hierarchy_table m2
WHERE m2.parent_id IN (SELECT m1.child_id
FROM $t_project_hierarchy_table m1
WHERE m1.child_id = m2.parent_id)
OR m2.parent_id = $c_project_id
UNION
SELECT $c_project_id from dual";

above
if ( $c_version_name != $c_old_version_name ) {

and now replace project_id='$c_project_id' in the update-where-clauses by project_id IN ($project_id_query)

brody

brody

2007-09-26 03:21

reporter   ~0015724

There are several patches as notes for this issue, but for which version of mantis are the patches to be applied? Its all the same version; the issue does not have any(more) a version information

W32

W32

2007-09-26 04:11

reporter   ~0015725

Does this patches will be included in 1.1 release?

mkornatzki

mkornatzki

2007-09-26 04:56

reporter   ~0015727

i implement and test it in 1.1.0a4

buus

buus

2008-01-02 19:40

reporter   ~0016530

This bug has been around for 2.5 years now.

vboctor, any chance that this could be assigned and put into 1.2?

W32

W32

2008-02-11 11:32

reporter   ~0017013

Anybody can upload cumulative patch for this issue for Mantis release 1.1.1 ?

stefang

stefang

2008-02-22 22:02

reporter   ~0017165

I would also be interested in a patch for Mantis 1.1.1!

Thanks in advance,
Stefan

vboctor

vboctor

2008-03-13 23:42

manager   ~0017331

When reporting a bug against a sub-project that has multiple parent projects, how is this handled by the patch? My feeling is that the patch assumes one parent project and hence gets the versions associated with the first version it finds.

W32

W32

2009-01-23 08:59

reporter   ~0020694

Whether this issue will be fixed?

aCCuReRaS

aCCuReRaS

2009-07-07 09:23

reporter   ~0022436

Is it possible to fix this issue in the next release? 1.2.x?
Would be nice.

vboctor

vboctor

2009-07-07 23:02

manager   ~0022439

I've checked this in into git trunk. I would appreciate if someone can try it out and give me feedback.

aCCuReRaS

aCCuReRaS

2009-07-09 05:47

reporter   ~0022460

Inheritance is working at first sight, altough the issues do not appear in roadmap/changelog.

polzin

polzin

2009-07-15 17:44

reporter   ~0022509

test, please ignore.

vboctor

vboctor

2009-07-28 08:44

manager   ~0022575

@aCCuReRaS, can you please provide the steps to reproduce the issue that you found?

aCCuReRaS

aCCuReRaS

2009-08-18 04:46

reporter   ~0022747

Sorry for the delay, but here are the steps:

  • Create a master project with a subproject
  • Create on the masterproject a version
  • Create on both master- and subproject an issue and set it resolved with target_version and fixed_in_version to the version you created above
  • When you select the master project, you will see on the roadmap/changelog page only the issue you created on the master project, the issue from the subproject isn't there.
  • When you select the subproject, and go to the roadmap/changelog page, you don't see anything at all.

I hope this helps!

aCCuReRaS

aCCuReRaS

2009-11-05 02:19

reporter   ~0023579

vboctor, can this issue be included in the final 1.2.0? It would make our version handling a lot easier, as we do 1 release each week, for +10 projects in our company.

hoy

hoy

2009-12-03 11:14

reporter   ~0023849

I second this need. A fix in official 1.2.0 would be nice.

papaya

papaya

2010-12-16 14:27

reporter   ~0027621

Last edited: 2010-12-16 14:50

May I kindly ask - is there any progress on that?

The management of subprojects is great so far; however as the generated roadmap does not include the subprojects' issues, it lacks a core feature for planning.

(our case is similar to what others described: a main project with subprojects, but only the main project shall carry versions. inheritation of the versions works, but the issues don't show up on the roadmap page)

Thanks!

W32

W32

2010-12-22 08:50

reporter   ~0027669

Last edited: 2010-12-22 08:54

Some questions.

  1. How can i hide parent project name in sub-project for inherited versions? Now, after switch on "Inherit Categories" for sub-projects in "Manage Projects" page, i have got the versions for sub-project inherited from parent project and named as "[Parent Name] Version". But, my parent project is technical (it is only core app) and should be hiden from users in changelog. What i should to do ?

  2. Many years my mantis works without version inheritance and now every sub-project have duplicated versions name (every time all sub-projects are released simultaneously). I upgraded my mantis to 1.2.4 and switched on "Inherit Categories" for sub-projects in "Manage Projects" page. How i can to merge and remove all versions from sub-projects to parent project?

cor3huis

cor3huis

2011-04-08 14:39

reporter   ~0028574

Last edited: 2011-04-08 14:42

@vboctor. "I've checked this in into git trunk. I would appreciate if someone can try it out and give me feedback."

I would love to test, on v1.2.5 stable currently. An I'm able to test have good understanding of Mantis used for some years already. I indeed do have projects with sub-projects where one sub-project is also a sub-project of a another Project.

But which version to do a Git Clone? Could you provide the commandline so I'm sure the version I'm cloning is correct. I think http://git.mantisbt.org/?p=mantisbt.git;a=snapshot;h=1e1c073be272d9785065c16b51d455a7f019d133;sf=tgz will also do correct?

Thus like:

PROJ_A
SUBROJ_X

PROJ_B
SUBROJ_X

cor3huis

cor3huis

2011-04-09 09:20

reporter   ~0028576

Goal: A roadmap page which also shows the roadmap of sub-projects on the page

I did test it on version 1.2.5 Git of 20110408 an the roadmap worked for sub-projects, Great!

I had:

PROJ_A
SUBROJ_X

PROJ_B
SUBROJ_X

Make sure you have:

  • A project with versions
  • Issues in the tracker that are not resolved
  • A Target Version set in every issue
  • A Viewable Project

One of the main thin to keep in mind that a roadmap is a Project bound to Version and Deliverydate. If one has no target version set it will an cannot show in the roadmap ofcourse.

If somethisn does not work since you upgraded from older versions then thes things might help:

  • Subproject inheritance

    Click button: Update subproject inheritance

    Then it does work, fine you are done!.

*Unlink

Unlink everythin first, set your version, then relink the sub-project
press [Unlink ]

Select all

update target version of a version in the dropdown

Now make it a sub-project again

...it works, than good. If id dioes not make sure you understand mantis and roadmap concept well, and try again with a new Project and subproject.

Notes:

Ensure you have set the config "$g_roadmap_view_threshold" to something good (e.g. VIEWER)

po

po

2013-02-28 13:55

reporter   ~0035332

Unfortunately, when I set a subproject as an active project I still cannot use parent versions in filters.

It can be seen also in "SubProject 2" subproject of "Mantis Touch" project.

OSS-SOS

OSS-SOS

2013-06-03 13:18

reporter   ~0037046

To display all versions of projects parents, I apply the following patches :

--- /usr/local/src/mantisbt-1.2.8/core/project_hierarchy_api.php        2011-09-06 16:23:10.000000000 +0200
+++ core/project_hierarchy_api.php      2013-06-03 18:35:34.613079934 +0200
@@ -135,7 +135,7 @@
  * @param bool $p_show_disabled Whether or not to consider projects which are disabled
  * @return int
  */
-function project_hierarchy_get_parent( $p_project_id, $p_show_disabled = false ) {
+function project_hierarchy_get_parent( $p_project_id, $p_show_disabled = false, $p_top_project=false ) {
    global $g_cache_project_hierarchy;

    project_hierarchy_cache( $p_show_disabled );
@@ -146,7 +146,15 @@

    foreach( $g_cache_project_hierarchy as $key => $value ) {
            if( in_array( $p_project_id, $g_cache_project_hierarchy[$key] ) ) {
-                       return $key;
+                       if ( $p_top_project ) {
+                               if ( $key ) {
+                                       return project_hierarchy_get_parent($key,$p_show_disabled,$p_top_project);
+                               } else {
+                                       return $p_project_id;
+                               }                               
+                       } else {
+                               return $key;
+                       }
            }
    }

--- /usr/local/src/mantisbt-1.2.8/core/version_api.php  2011-09-06 16:23:10.000000000 +0200
+++ core/version_api.php        2013-06-03 18:56:04.665299887 +0200
@@ -461,7 +461,8 @@
  * @return array
  */
 function version_get_all_rows_with_subs( $p_project_id, $p_released = null, $p_obsolete = false ) {
-       $t_project_where = helper_project_specific_where( $p_project_id );
+
+       $t_project_where = helper_project_specific_where( project_hierarchy_get_parent($p_project_id,false,true) );

    $t_param_count = 0;
    $t_query_params = array();
po

po

2013-06-24 09:39

reporter   ~0037267

Very simple solution!

Indeed it gives to much versions on the list (it gives versions of the top parent project and its <u>all</u> subprojects), but it is much much better solution than the original one, which gives incomplete list.

Thank you!

artiflo

artiflo

2015-05-18 11:15

reporter   ~0050781

There is a easier solution : https://www.mantisbt.org/bugs/view.php?id=12261#c50633

Related Changesets

MantisBT: master 336a964e

2009-07-07 22:07

vboctor


Details Diff
Fixes 0005668: versions of parent project should be used in subprojects. Affected Issues
0005668
mod - core/print_api.php Diff File
mod - docbook/adminguide/en/configuration.sgml Diff File
mod - manage_proj_edit_page.php Diff File
mod - view_filters_page.php Diff File
mod - core/version_api.php Diff File
mod - core/category_api.php Diff File
mod - core/prepare_api.php Diff File
mod - config_defaults_inc.php Diff File
mod - bug_view_advanced_page.php Diff File
mod - bug_view_page.php Diff File
mod - core/filter_api.php Diff File
mod - manage_proj_page.php Diff File
mod - print_bug_page.php Diff File

MantisBT: master-1.2.x 9c4a9b75

2009-07-07 22:07

vboctor


Details Diff
Fixes 0005668: versions of parent project should be used in subprojects. Affected Issues
0005668
mod - bug_view_page.php Diff File
mod - core/print_api.php Diff File
mod - manage_proj_edit_page.php Diff File
mod - docbook/adminguide/en/configuration.sgml Diff File
mod - view_filters_page.php Diff File
mod - core/version_api.php Diff File
mod - core/category_api.php Diff File
mod - print_bug_page.php Diff File
mod - core/prepare_api.php Diff File
mod - config_defaults_inc.php Diff File
mod - core/filter_api.php Diff File
mod - bug_view_advanced_page.php Diff File
mod - manage_proj_page.php Diff File