Feature #16941

Do not clear category on project change if category with same exists

Added by Danil Tashkinov almost 4 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues
Target version:3.2.0
Resolution:Fixed

Description

Category cleared when changing project for an issue.

Steps to reproduce:
1. There is a 'project1' with category 'some' and 'project2' with the same name category.
2. Create an issue in 'project1' and select 'some' category.
3. Open edit form for this issue.
4. Select 'project2'

Expected result:
The 'project2' has a category with the same name: 'some'. And we expect that the category will be 'some'.

Actually result:
The category field is empty.

do_not_clear_category_on_project_change.diff Magnifier (896 Bytes) Danil Tashkinov, 2014-05-21 15:22

do_not_clear_category_on_project_change-2015-06-16-master.diff Magnifier (573 Bytes) Alexander Stehlik, 2015-06-16 15:00


Related issues

Related to Redmine - Feature #5358: Share Issues Categories for sub-projects New 2010-04-20
Related to Redmine - Defect #19517: Copy issue with new project Closed

Associated revisions

Revision 14715
Added by Jean-Philippe Lang over 2 years ago

Do not clear category on project change if category with same exists (#16941).

History

#1 Updated by Toshi MARUYAMA almost 4 years ago

  • Target version set to 2.6.0

#2 Updated by Toshi MARUYAMA almost 4 years ago

  • Target version deleted (2.6.0)

#3 Updated by Toshi MARUYAMA almost 4 years ago

"Category" is depends on project.
Category ids not same even if category names are same.
I think clearing category is expected behavior.

#4 Updated by Toshi MARUYAMA almost 4 years ago

  • Related to Feature #5358: Share Issues Categories for sub-projects added

#5 Updated by Jean-Baptiste Barth over 3 years ago

  • Status changed from New to Closed

I confirm, there's no point in having a different behaviour in the general case I think. If you want persistent values across projects then you'd better use a custom field. If there's something lacking with custom field, tell us (maybe the ability to add a value from an issue for instance?). I close this issue for now.

#6 Updated by Go MAEDA about 3 years ago

#7 Updated by Alexander Stehlik almost 3 years ago

I guess this is a bug because Redmine behaves inconsistently here: when you edit multiple issues and change the project, categories with the same name will be preserved - see project setter for issues:

if category
    self.category = project.issue_categories.find_by_name(category.name)
end

When you edit a single issue and you change the project, the category should not be cleared but should be set to a category with the same name (if available).

#8 Updated by Alexander Stehlik almost 3 years ago

Rebased the patch to current master.

#9 Updated by Toshi MARUYAMA almost 3 years ago

  • Status changed from Closed to New
  • Target version set to 3.2.0

#10 Updated by Jean-Philippe Lang over 2 years ago

  • Tracker changed from Patch to Feature
  • Subject changed from Do not clear category on project change to Do not clear category on project change if category with same exists
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

This is fixed in r14715. Slightly different fix, and test added.
Thanks for pointing this out.

Also available in: Atom PDF