Feature #5358

Share Issues Categories for sub-projects

Added by Enderson Maia about 2 years ago. Updated about 1 month ago.

Status:New Start date:2010-04-20
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Issues
Target version:-
Resolution:

Description

I think that should be possible to set each category to be use to all the sub-projects.

I use a top-level projects as a help desk, and the sub-projects as departaments. And I have categories related to many areas like

  • Hardware - Printer
  • Hardware - CPU
  • System - Intranet
  • System - Redmine
    .... A LOT MORE

If I could only say that these TOP-LEVEL categories can be used in sub-projects, wold solve my problem.

redmine-5358.diff (8.3 kB) Magnifier Daniel Neis Araujo, 2011-02-16 18:21

5358-first.working.version.diff (9.6 kB) Magnifier Daniel Neis Araujo, 2011-02-18 00:38

shared_categories_redmine_13.patch (16.1 kB) Magnifier Leo Shklovskii, 2012-02-23 02:04

shared_categories_redmine_13.patch (16.6 kB) Magnifier Leo Shklovskii, 2012-02-23 02:29

shared_categories_redmine_1.3.1_v3.diff (16.7 kB) Magnifier Leo Shklovskii, 2012-03-20 21:58


Related issues

duplicated by Feature #5186: Issue Categories inheritance Closed 2010-03-25
duplicated by Feature #4159: Make Issue categories to be inherited with the project Closed 2009-11-02

History

#1 Updated by Enderson Maia about 2 years ago

I was making the search for sharing categories, but when searching for inheritance and other terms I found the ticket #1278, #2521

They talk about a way to make categories global or default, what is different form my suggestion.

I can see 3 different ways to solve the problem that is common in my and the other requests:

  1. Enable copy of Categories between projects (http://www.redmine.org/boards/2/topics/4992), a little manual, but less than typing.
  2. Enable sharing of categories for sub-projects. On the parent project, I should select what category to share with sub-projects.
  3. Enable inheritance of categories. On the sub-project I could activate the inheritance of all/some parent-project categories.
  4. Use the same behavior of Version sharing from release 0.9.3.

#2 Updated by Enderson Maia about 2 years ago

Enderson Maia wrote:

...
I can see 3 different ways to solve the problem that is common in my and the other requests:
...

I mean, 4 (four) :)

#3 Updated by Marton Danoczy over 1 year ago

+1 this functionality would be really useful.
Duplicate of #5186, #4159

#4 Updated by YongSeop Lim over 1 year ago

+1

#5 Updated by David Raison over 1 year ago

+1

#6 Updated by Wan Zhenhuan over 1 year ago

+1
even a global issue category feature is also pretty useful, just like the target version can be shared to all the projects

#7 Updated by Oli Kessler over 1 year ago

+1

#8 Updated by Daniel Neis Araujo over 1 year ago

+1

#9 Updated by Rolf Stetter over 1 year ago

+1

#10 Updated by Ivan Cenov over 1 year ago

+1

#11 Updated by Daniel Neis Araujo over 1 year ago

As noted by Aurélien LAJOIE, in #4195 , i think this should be implemented as version sharing (#465).

#13 Updated by Daniel Neis Araujo over 1 year ago

Hello, i am attaching a first version of a patch to adapt the code from version sharing to issue category change.
Still needs review and tests and would be good to implement some tests also...

Hope you like.

#14 Updated by Daniel Neis Araujo over 1 year ago

the patch
;)

#15 Updated by Daniel Neis Araujo over 1 year ago

Hello, this versions of patch applies to master and seems to work. I've made some navigations tests and things seems to work.
Any help in test/refactor the code is appreciated =)

#16 Updated by Chris Darts over 1 year ago

I just tried to run this patch on Redmine v1.1.1 and received the following error message:

patching file b/app/controllers/issue_categories_controller.rb
Hunk #1 FAILED at 25.
1 out of 1 hunk FAILED -- saving rejects to file b/app/controllers/issue_categories_controller.rb.rej
patching file b/app/helpers/projects_helper.rb
Hunk #1 FAILED at 105.
1 out of 1 hunk FAILED -- saving rejects to file b/app/helpers/projects_helper.rb.rej
patching file b/app/models/issue.rb
Hunk #1 FAILED at 143.
Hunk #2 FAILED at 313.
Hunk #3 FAILED at 414.
Hunk #4 FAILED at 573.
Hunk #5 FAILED at 776.
5 out of 5 hunks FAILED -- saving rejects to file b/app/models/issue.rb.rej
patching file b/app/models/issue_category.rb
Hunk #1 FAILED at 16.
Hunk #2 FAILED at 40.
2 out of 2 hunks FAILED -- saving rejects to file b/app/models/issue_category.rb.rej
patching file b/app/models/project.rb
Hunk #1 FAILED at 384.
1 out of 1 hunk FAILED -- saving rejects to file b/app/models/project.rb.rej
patching file b/app/views/issue_categories/_form.rhtml
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file b/app/views/issue_categories/_form.rhtml.rej
patching file b/app/views/issues/_attributes.rhtml
Hunk #1 FAILED at 9.
1 out of 1 hunk FAILED -- saving rejects to file b/app/views/issues/_attributes.rhtml.rej
patching file b/db/migrate/20110216000000_add_issue_category_sharing.rb

Any ideas?

#17 Updated by Daniel Neis Araujo over 1 year ago

Hello,

which version of the patch are you using? I have applied the "5358-first.working.version.diff", to the current redmine master commit (https://github.com/danielneis/redmine/tree/3ab981c04c33ebc1a490063d2d626fa669721209) and it worked well.
I've setup a git repository that you can try. Here is the link for the branch: https://github.com/danielneis/redmine/tree/5358-issue.category.sharing

Thanks for testing the patch!

Kind regards,
Daniel

#18 Updated by Chris Darts about 1 year ago

I also used version '5358-first.working.version.diff' as uploaded 8 days ago.

I was using the redmine version at https://github.com/edavis10/redmine, but I've now set up a working copy from the svn (Redmine 1.1.1.stable.4943 (MySQL)) and I received the same error.

I'm fairly new to this and not a rails developer so excuse my ignorance, but I'm wondering why it's trying to write to a file in 'b/app/controllers' where there isn't a 'b' directory in the root of Redmine?

I would love to get this working so any assistance would be greatly appreciated.

#19 Updated by Daniel Neis Araujo about 1 year ago

Hello,

what command have you used to apply the patch?
The patch was generated by git, so the 'a' is the original file and 'b' is the new version of file.
You must apply the patch with 'patch -p1 < 5358-first.working.version.diff' to ignore the first directory level in the diff file.

HTH,
Daniel

#20 Updated by Chris Darts about 1 year ago

Thanks Daniel. I now tried it with -p1 instead of -p0 and it worked fine.

However, I just tried to test it out with one of my projects and I received the following error when I click on the 'new category' link.

Any help would be greatly appreciated.

NameError in Issue_categories#new

Showing app/views/issue_categories/_form.rhtml where line #6 raised:

undefined local variable or method `sharing' for #<IssueCategory:0xb5f938e0>

Extracted source (around line #6):

3: <div class="box">
4: <p><%= f.text_field :name, :size => 30, :required => true %></p>
5: <p><%= f.select :assigned_to_id, @project.users.sort.collect{|u| [u.name, u.id]}, :include_blank => true %></p>
6: <p><%= f.select :sharing, @category.allowed_sharings.collect{|c| [format_category_sharing(c), c]} %></p>
7: </div>

#21 Updated by Daniel Neis Araujo about 1 year ago

Hello,

you must execute "rake db:migrate:all" to create the "sharing" column on "issue_categories" table.
More info on redmine upgrages at http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade

Regards,
Daniel

#22 Updated by Chris Darts about 1 year ago

It works perfectly now. This is a great addition to Redmine.

Thanks for your quick response.

#23 Updated by Etienne Massip about 1 year ago

  • Category set to Issues

#24 Updated by Declan Lynch about 1 year ago

+1

The requirements for inheriting issue categories in subprojects just came up for our RedMine users.

#25 Updated by Chris Darts 12 months ago

I've just tested the patch file on the new Redmine 1.2.0 release and it seems there are some compatibilty issues.

This is the output after trying to apply the patch:

$ patch -p1 < 5358-first.working.version.diff 
patching file app/controllers/issue_categories_controller.rb
patching file app/helpers/projects_helper.rb
patching file app/models/issue.rb
Hunk #1 succeeded at 165 (offset 22 lines).
Hunk #2 FAILED at 317.
Hunk #3 FAILED at 418.
Hunk #4 FAILED at 577.
Hunk #5 FAILED at 780.
4 out of 5 hunks FAILED -- saving rejects to file app/models/issue.rb.rej
patching file app/models/issue_category.rb
patching file app/models/project.rb
Hunk #1 succeeded at 403 with fuzz 1 (offset 19 lines).
patching file app/views/issue_categories/_form.rhtml
patching file app/views/issues/_attributes.rhtml
patching file db/migrate/20110216000000_add_issue_category_sharing.rb

#26 Updated by Daniel Neis Araujo 12 months ago

Hello,

i've not had time to update the patch for 1.2.0 but i hope i can do this next week.

Regards,
Daniel

#27 Updated by Chris Darts 12 months ago

Daniel Neis Araujo wrote:

i've not had time to update the patch for 1.2.0 but i hope i can do this next week.

Thanks Daniel, this is great news. Currently this is the only thing stopping me from upgrading to 1.2.0 and it's such a useful patch that I can't consider upgrading without it.

Chris

#28 Updated by Daniel Neis Araujo 12 months ago

Hello,

i've rebased my patch to Redmine-1.2-stable, and here is the full patch:

https://github.com/danielneis/redmine/commit/3a959c3c89d6bcec8e26eb13cc22f271f7252209

you can add .diff or .patch to the end to download the desired format or use git to merge directly from my repository.

HTH,
Daniel

#29 Updated by Chris Darts 12 months ago

I've just tested this on Redmine 1.2.0.stable.6000 and it seems to work fine.

Thanks Daniel.

#30 Updated by Tao Lin 9 months ago

+1

#31 Updated by Andrew Dahlin 8 months ago

+1 any chance on this getting merged into a release?

#32 Updated by Siegfried Vogel 8 months ago

+1

#33 Updated by Marton Danoczy 8 months ago

+1

#34 Updated by Raul Fortes 8 months ago

+1

#35 Updated by Kunal Ashar 7 months ago

Perhaps I'm doing something silly, but when I updated the code (Bitnami Redmine 1.2) to patch it, nothing happened.
Specifically:
  • The sharing column was added to the issue_categories table in the DB, with "none" filled into category's sharing column
  • Categories specified in parent projects did not appear in the child projects
  • I changed the sharing value to "descendants" in the DB, but that didn't help either.
  • There was no change in the user interface to indicate any form of sharing.

What am I doing wrong?

#36 Updated by Daniel Neis Araujo 7 months ago

Hello, Kunal

which version of patch did you used? Also, did you applied the patch with git or "patch -p1" ? I've not updated the patch in last 5 months, so something in redmine could broke my patch...
If you send me the commands you used and the outputs, i can try to help you

Kind Regards,
Daniel

#37 Updated by Terence Mill 7 months ago

+1

#38 Updated by Gurvan Le Dromaguet 5 months ago

+1, integrated in my redmine instance

#39 Updated by Tobias Fischer 4 months ago

Gurvan Le Dromaguet wrote:

+1, integrated in my redmine instance

On which redmine version did you apply the patch?
Is it working with 1.3.0?

#40 Updated by Miguel Filho 4 months ago

+1

#41 Updated by Artur Wasilewski 3 months ago

+1

#42 Updated by Martin Denizet 3 months ago

Me too I'd like to see this feature in Redmine. It would save me quite some time updating all my sub-projects's categories.

#43 Updated by Leo Shklovskii 3 months ago

Daniel's patch didn't work for 1.3 (primarily because of the view renames from .rhtml to .html.erb), so here's a re-written version of it for 1.3 with a few minor improvements.

Keep in mind that this is a pretty messy hack in a lot of ways. It basically clones the functionality of Versions to Categories. Some esoteric project operations may not properly reset categories when that's needed.

#44 Updated by Leo Shklovskii 3 months ago

And there was a bug in my patch, fixed and re-uploaded. Also, to clarify, this patch is against the 1.3.1 release.

#45 Updated by alan blount 2 months ago

+1 -- anyone want to make this into a plugin, or can we roll it into the core application -- it seems like an obvious win.

#46 Updated by Leo Shklovskii 2 months ago

Ugh, the previous version of the patch had a few crashes. This is the final version, we've been running it for two weeks without any problems.

It's really hard to turn this into a plugin since it monkeypatches pieces of core methods. As far as actually integrating it into core, there's probably a ton more work and tests that need to be done. As it is, it's a pretty messy hack.

#47 Updated by Bruno Plantier about 1 month ago

Leo Shklovskii wrote:

Ugh, the previous version of the patch had a few crashes. This is the final version, we've been running it for two weeks without any problems.

It's really hard to turn this into a plugin since it monkeypatches pieces of core methods. As far as actually integrating it into core, there's probably a ton more work and tests that need to be done. As it is, it's a pretty messy hack.

Hi,

I tried to apply your patch, I still have an error in my log:

Processing IssueCategoriesController#new (for ::1 at 2012-03-27 11:54:17) [GET]
  Parameters: {"project_id"=>"test", "action"=>"new", "controller"=>"issue_categories"}
Rendering template within layouts/base
Rendering issue_categories/new

ActionView::TemplateError (uninitialized constant IssueCategory::SHARINGS) on line #6 of app/views/issue_categories/_form.html.erb:
3: <div class="box">
4: <p><%= f.text_field :name, :size => 30, :required => true %></p>
5: <p><%= f.select :assigned_to_id, principals_options_for_select(@project.assignable_users, @category.assigned_to), :include_blank => true %></p>
6: <p><%= f.select :sharing, @category.allowed_sharings.collect{|c| [format_category_sharing_simple(c), c]} %></p>
7: </div>

    app/models/issue_category.rb:49:in `allowed_sharings'
    app/views/issue_categories/_form.html.erb:6
    app/views/issue_categories/new.html.erb:4
    app/helpers/application_helper.rb:871:in `labelled_tabular_form_for'
    app/views/issue_categories/new.html.erb:3
    config/initializers/mongrel_cluster_with_rails_211_fix.rb:62:in `dispatch_cgi'

Rendering /Applications/redmine-1.3.1-1/apps/redmine/public/500.html (500 Internal Server Error)

What I have done on my bitnami redmine stack (version of redmine is 1.3.1):

cd /Applications/redmine-1.3.1-1/apps/redmine
patch -p1 < shared_categories_redmine_1.3.1_v3.diff
../../use_redmine
rake db:migrate:all RAILS_ENV=production
../../ctlscript.sh restart

I have checked the issue_categories table, the field sharing have been created, here its description
Type : varchar(255)
Charset : utf8_general_ci
Null : No
Default : none

An idea ?

Regards,
Bruno

PS: I am a total newbie in ruby/redmine so please, give me a chance to learn, thanks a lot ;o)

Also available in: Atom PDF