Patch #30919

Group Issues Custom Fields - (Form like Issues)

Added by Frederico Camara over 1 year ago. Updated 4 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:Candidate for next major release

Description

This patch adds a new tab in the project settings. In this tab, you can reorder and group custom fields for each tracker.

Reordering and grouping custom fields makes them appear as this for this project only in vieweing an issue and editing an issue.

It was developed for Redmine 3.2. In Redmine 3.4~, you can make a custom field take the full width, which makes these go to the bottom of the issue page. I had to adapt it so that you can still reorder the half width custom fields separated from the full width custom fields.

If it sounds confusing, see the screenshots (sorry they are in portuguese).

To apply:

patch p1 < GCF<your redmine version>.patch
touch tmp/restart.txt
RAILS_ENV=production bundle exec rake db:migrate

PDF and email formatting not implemented yet.

GCF1.jpg - Settings tab for Grouping Custom Fields (128 KB) Frederico Camara, 2019-02-25 16:58

GCF2.jpg - Grouped Custom Fields in a new issue (109 KB) Frederico Camara, 2019-02-25 16:58

GCF3.jpg - Grouped Custom Fields in a new issue (filled) (160 KB) Frederico Camara, 2019-02-25 16:58

GCF4.jpg - Issue view with Grouped Custom Fields (137 KB) Frederico Camara, 2019-02-25 16:58

GCF-3.2.patch Magnifier (21.8 KB) Frederico Camara, 2019-02-25 17:05

GCF-3.4.patch Magnifier (25.7 KB) Frederico Camara, 2019-02-25 17:05

GCF-4.0.patch Magnifier (26.3 KB) Frederico Camara, 2019-02-25 17:05

GCFep-4.0.patch Magnifier (12.7 KB) Frederico Camara, 2019-02-27 15:03

GCFep-3.4.patch Magnifier (12.7 KB) Frederico Camara, 2019-02-27 15:03

GCFep-3.2.patch Magnifier (6.4 KB) Frederico Camara, 2019-02-27 15:03

GCF-3.4-final1.patch Magnifier (39.3 KB) Frederico Camara, 2019-03-01 17:22

GCF-4.0-final1.patch Magnifier (39.9 KB) Frederico Camara, 2019-03-01 17:22

GCF-3.2-final1.patch Magnifier (33.6 KB) Frederico Camara, 2019-03-01 17:22

GCF-4.0-final1-fixed.patch Magnifier - Fix for rails 5 or greater (39.9 KB) Frederico Camara, 2020-01-01 19:28

Snímek obrazovky 2020-01-05 v 9.58.02.png (42.9 KB) Petr Kokosak, 2020-01-05 09:59

Snímek obrazovky 2020-01-05 v 9.58.36.png (65.1 KB) Petr Kokosak, 2020-01-05 09:59

Snímek obrazovky 2020-01-05 v 9.58.52.png (46.4 KB) Petr Kokosak, 2020-01-05 09:59

GCF-4.1.patch Magnifier - For Redmine 4.1 (34.1 KB) Frederico Camara, 2020-04-17 23:02

group.png (10.9 KB) Yuri Azanov, 2020-04-18 21:43

History

#1 Updated by Frederico Camara over 1 year ago

Cant edit description. Forgot to include the patch. For stable versions of Redmine 3.2, 3.4 and 4.0.

To apply:

patch -p1 < GCF-<your redmine version>.patch
touch tmp/restart.txt
RAILS_ENV=production bundle exec rake db:migrate

#2 Updated by Go MAEDA over 1 year ago

  • Target version set to Candidate for next major release

#3 Updated by Frederico Camara over 1 year ago

Including patches for mail and pdf formatting. Apply after the first patch:

patch -p1 < GCFen-<your redmine version>.patch
touch tmp/restart.txt

#4 Updated by Frederico Camara over 1 year ago

BUGFIX: Can't delete projects, trackers, custom_fields if there is any grouping.

- Very problematic, you would have to look project by project, remove groups. This patch fixes everything.
- Other fix: the database position entry was created incorrectly. acts_as_list has to set position to null.
- A bit of code refactoring.

Consolidated patch.

This is a consolidated patch for redmine 3.2, 3.4 and 4.0. Apply just this one.

patch -p1 < GCF-<your redmine version>.patch
RAILS_ENV=production bundle exec rake db:migrate
touch tmp/restart.txt

#5 Updated by Zoltán Schmidt 10 months ago

I have installed the patch and does not work.
Please give me some advice, how to use your patch!
Redmine version: 4.0.5.stable

The result:

Internal error
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Back

and the production.log:

Redirected to https://oururl/
Completed 302 Found in 35ms (ActiveRecord: 23.6ms)
Started GET "/" for 80.95.86.254 at 2019-12-31 20:24:13 +0000
Processing by WelcomeController#index as HTML
Current user: myname (id=21)
Rendering welcome/index.html.erb within layouts/base
Rendered welcome/index.html.erb within layouts/base (3.5ms)
Completed 200 OK in 156ms (Views: 15.1ms | ActiveRecord: 12.0ms)
Started GET "/projects" for 80.95.86.254 at 2019-12-31 20:24:17 +0000
Processing by ProjectsController#index as HTML
Current user: myname (id=21)
Rendering projects/index.html.erb within layouts/base
Rendered projects/index.html.erb within layouts/base (11.8ms)
Completed 200 OK in 50ms (Views: 24.6ms | ActiveRecord: 13.3ms)
Started GET "/projects/ourproject" for 80.95.86.254 at 2019-12-31 20:24:19 +0000
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"ourproject"}
Current user: myname (id=21)
Rendering projects/show.html.erb within layouts/base
Rendered projects/_members_box.html.erb (5.4ms)
Rendered projects/show.html.erb within layouts/base (19.4ms)
Completed 200 OK in 125ms (Views: 48.8ms | ActiveRecord: 19.3ms)
Started GET "/projects/ourproject/settings" for 80.95.86.254 at 2019-12-31 20:24:21 +0000
Processing by ProjectsController#settings as HTML
Parameters: {"id"=>"ourproject"}
Current user: myname (id=21)
Completed 500 Internal Server Error in 59ms (ActiveRecord: 10.6ms)

@NameError (uninitialized constant ProjectsController::AttributeGroup):


@app/controllers/projects_controller.rb:180:in `settings'

lib/redmine/sudo_mode.rb:63:in `sudo_mode'

#6 Updated by Frederico Camara 10 months ago

Zoltán Schmidt wrote:

I have installed the patch and does not work.
Please give me some advice, how to use your patch!
Redmine version: 4.0.5.stable

Maybe you had issues with the database migration. Migrations are versioned since Rails 5.
I'm submitting a fixed 4.0 patch. if you already have it patched, try this:

# adds a '[4.2]' to the end of first line
cd <redmine directory>
sed 's/ActiveRecord::Migration$/&[4.2]/' -i db/migrate/20180913211420_create_attribute_groups.rb
sed 's/ActiveRecord::Migration$/&[4.2]/' -i db/migrate/20180913212008_create_attribute_group_fields.rb
sed 's/ActiveRecord::Migration$/&[4.2]/' -i db/migrate/20190301162408_change_group_position_attributes.rb
RAILS_ENV=production bundle exec rake db:migrate
touch tmp/restart.tmp

#7 Updated by Petr Kokosak 10 months ago

Hello, please help me. I have installed the your patch for Redmine version 4.1.0.stable and work perfect.
I need help with designing items in a group.

My environment:
Redmine version 4.1.0.stable
Ruby version 2.7.0-p0 (2019-12-25) [x86_64-darwin18]
Rails version 5.2.4.1
Environment production
Database adapter Mysql2

How can I solve the following samples ?

First example :  9.58.02.png
Second example : 9.58.36.png
Third example : 9.58.52.png

Thank you so much for your answer.
Petr

#8 Updated by Frederico Camara 10 months ago

Petr Kokosak wrote:

Hello, please help me. I have installed the your patch for Redmine version 4.1.0.stable and work perfect.
I need help with designing items in a group.

This is not addressed by this patch. It does not meddle with Redmine's original css widths. Maybe you should fix the width in a theme.

At this moment, this patch does not organize which information goes on the left or right column, or how much space it takes, they are distributed evenly. Redmine originally does not care which information goes where, or even the order. This is mainly to give the order more flexibility.

To have real forms in Redmine, the effort should be bigger. Redmine makes possible that different roles see different fields, and some custom fields show up only when the issue is at cartain statuses. A real form do not address any of these things.

Best Regards.

#9 Updated by Yuri Azanov 6 months ago

Can you make diff patch for redmine 4.1.0 please?

#10 Updated by Frederico Camara 6 months ago

Yuri Azanov wrote:

Can you make diff patch for redmine 4.1.0 please?

Here it is.

#11 Updated by Yuri Azanov 6 months ago

Frederico Camara wrote:

Yuri Azanov wrote:

Can you make diff patch for redmine 4.1.0 please?

Here it is.

Thanks! I have some problem:
Patch apply successfully, no error.
DB migrate execute whitout any verbose steps in console (DB was not modifed!!! Why?).
New db migrate file found in db/mifrate folder (it's OK):
20180913211420_create_attribute_groups.rb
20180913212008_create_attribute_group_fields.rb
20190301162408_change_group_position_attributes.rb

After restart redmine there are error in production.log:
ActiveRecord::StatementInvalid (Mysql2::Error: Table 'bitnami_redmineplusagile.attribute_groups' doesn't exist: SHOW FULL FIELDS FROM `attribute_groups`):

tables was not created...why?

Environment:
Redmine version 4.1.0.stable
Ruby version 2.5.7-p206 (2019-10-01) [x86_64-linux]
Rails version 5.2.4.1
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp

#12 Updated by Frederico Camara 6 months ago

Yuri Azanov wrote:

DB migrate execute whitout any verbose steps in console (DB was not modifed!!! Why?).

It does not make any sense. Wrong directory? Wrong command?

I used 'RAILS_ENV=production bundle exec rake db:migrate'.

#13 Updated by Yuri Azanov 6 months ago

Now it's migrated successfully, thank.
I don't understand how it's work this subject.
There are new tab "Grouped Custom Fileds" in project settings, i fill Groupded Custom Fields, then press "+" and "Save" but there are nothing happened...
How it's work?

#14 Updated by Frederico Camara 6 months ago

Yuri Azanov wrote:

Now it's migrated successfully, thank.
I don't understand how it's work this subject.
There are new tab "Grouped Custom Fileds" in project settings, i fill Groupded Custom Fields, then press "+" and "Save" but there are nothing happened...
How it's work?

Look at the reference jpgs I posted (first attachments on this issue). Your picture looks nothing like them.

Maybe you are using an old browser or have disabled javascript, or the css is not getting through to the browser.

#15 Updated by Yuri Azanov 6 months ago

You are right. If change theme to Standard, it's worked nice!!!

It seem to me there are "PurpleMine2" theme trouble.

Thank you!Be healthy!

p.s. It would be nice make this option Global, for trackers (not only for each project...)

#16 Updated by Adriano Bellia 29 days ago

Hello,
wonderful patch.

I have Redmine 4.0.3

If I try to apply the patch it gives the followingg message

patch --dry-run -p1 < /home/bitnami/GCF-4.0-final1-fixed.patch
checking file app/controllers/projects_controller.rb
checking file app/helpers/issues_helper.rb
checking file app/helpers/projects_helper.rb
checking file app/models/attribute_group.rb
checking file app/models/attribute_group_field.rb
checking file app/models/custom_field.rb
checking file app/models/project.rb
checking file app/models/tracker.rb
checking file app/views/issues/_form_custom_fields.html.erb
checking file app/views/issues/show.html.erb
checking file app/views/projects/settings/_groupissuescustomfields.html.erb
checking file config/locales/en.yml
Hunk #1 succeeded at 1227 (offset 4 lines).
checking file config/locales/pt-BR.yml
Hunk #1 succeeded at 1243 (offset 4 lines).
checking file config/routes.rb
Hunk #1 succeeded at 108 (offset 3 lines).
checking file db/migrate/20180913211420_create_attribute_groups.rb
checking file db/migrate/20180913212008_create_attribute_group_fields.rb
checking file db/migrate/20190301162408_change_group_position_attributes.rb
checking file lib/redmine.rb
checking file lib/redmine/export/pdf/issues_pdf_helper.rb
Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #2 succeeded at 74 with fuzz 1 (offset 6 lines).
Hunk #3 FAILED at 85.
Hunk #4 FAILED at 101.
Hunk #5 succeeded at 147 with fuzz 2 (offset -46 lines).
Hunk #6 succeeded at 174 (offset -46 lines).
Hunk #7 succeeded at 202 (offset -46 lines).
Hunk #8 succeeded at 222 (offset -46 lines).
Hunk #9 FAILED at 297.
Hunk #10 succeeded at 278 (offset -46 lines).
Hunk #11 succeeded at 286 (offset -46 lines).
Hunk #12 succeeded at 294 (offset -46 lines).
Hunk #13 succeeded at 334 (offset -46 lines).
Hunk #14 succeeded at 347 (offset -46 lines).
Hunk #15 succeeded at 366 (offset -46 lines).
3 out of 15 hunks FAILED
checking file public/stylesheets/application.css
Hunk #1 succeeded at 476 (offset 1 line).
Hunk #2 succeeded at 1551 (offset 1 line).
checking file test/fixtures/attribute_group_fields.yml
checking file test/fixtures/attribute_groups.yml

I have another patch applied on field permissions. Does it mean they are not compatible?

#17 Updated by Frederico Camara 29 days ago

Adriano Bellia wrote:

Hello,
wonderful patch.

I have Redmine 4.0.3

If I try to apply the patch it gives the followingg message

patch --dry-run -p1 < /home/bitnami/GCF-4.0-final1-fixed.patch
checking file app/controllers/projects_controller.rb
checking file app/helpers/issues_helper.rb
checking file app/helpers/projects_helper.rb
checking file app/models/attribute_group.rb
checking file app/models/attribute_group_field.rb
checking file app/models/custom_field.rb
checking file app/models/project.rb
checking file app/models/tracker.rb
checking file app/views/issues/_form_custom_fields.html.erb
checking file app/views/issues/show.html.erb
checking file app/views/projects/settings/_groupissuescustomfields.html.erb
checking file config/locales/en.yml
Hunk #1 succeeded at 1227 (offset 4 lines).
checking file config/locales/pt-BR.yml
Hunk #1 succeeded at 1243 (offset 4 lines).
checking file config/routes.rb
Hunk #1 succeeded at 108 (offset 3 lines).
checking file db/migrate/20180913211420_create_attribute_groups.rb
checking file db/migrate/20180913212008_create_attribute_group_fields.rb
checking file db/migrate/20190301162408_change_group_position_attributes.rb
checking file lib/redmine.rb
checking file lib/redmine/export/pdf/issues_pdf_helper.rb
Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #2 succeeded at 74 with fuzz 1 (offset 6 lines).
Hunk #3 FAILED at 85.
Hunk #4 FAILED at 101.
Hunk #5 succeeded at 147 with fuzz 2 (offset -46 lines).
Hunk #6 succeeded at 174 (offset -46 lines).
Hunk #7 succeeded at 202 (offset -46 lines).
Hunk #8 succeeded at 222 (offset -46 lines).
Hunk #9 FAILED at 297.
Hunk #10 succeeded at 278 (offset -46 lines).
Hunk #11 succeeded at 286 (offset -46 lines).
Hunk #12 succeeded at 294 (offset -46 lines).
Hunk #13 succeeded at 334 (offset -46 lines).
Hunk #14 succeeded at 347 (offset -46 lines).
Hunk #15 succeeded at 366 (offset -46 lines).
3 out of 15 hunks FAILED
checking file public/stylesheets/application.css
Hunk #1 succeeded at 476 (offset 1 line).
Hunk #2 succeeded at 1551 (offset 1 line).
checking file test/fixtures/attribute_group_fields.yml
checking file test/fixtures/attribute_groups.yml

I have another patch applied on field permissions. Does it mean they are not compatible?

Not exactly, see that most of the patch would apply, except for lib/redmine/export/pdf/issues_pdf_helper.rb

Also, you should not assume -R (revert), as the patch must be applied.

The problem is I have found whitespaces in the source file and tried to fix that with the patch (I shouldn' have tried it). Probably maintainers fixed that concurrently. The result is a file (before the patch) somewhat different, so the patch gives errors. You may edit that part out of the patch and apply it manually, it's not that difficult. Most hunks just delete whitespaces.

#18 Updated by Adriano Bellia 16 days ago

Thank yoy for your reply, I didn't see it before.
I'll try soon and ask your help if I don't undestand something :)

Thank you again

Frederico Camara wrote:

Adriano Bellia wrote:

Hello,
wonderful patch.

I have Redmine 4.0.3

If I try to apply the patch it gives the followingg message

patch --dry-run -p1 < /home/bitnami/GCF-4.0-final1-fixed.patch
checking file app/controllers/projects_controller.rb
checking file app/helpers/issues_helper.rb
checking file app/helpers/projects_helper.rb
checking file app/models/attribute_group.rb
checking file app/models/attribute_group_field.rb
checking file app/models/custom_field.rb
checking file app/models/project.rb
checking file app/models/tracker.rb
checking file app/views/issues/_form_custom_fields.html.erb
checking file app/views/issues/show.html.erb
checking file app/views/projects/settings/_groupissuescustomfields.html.erb
checking file config/locales/en.yml
Hunk #1 succeeded at 1227 (offset 4 lines).
checking file config/locales/pt-BR.yml
Hunk #1 succeeded at 1243 (offset 4 lines).
checking file config/routes.rb
Hunk #1 succeeded at 108 (offset 3 lines).
checking file db/migrate/20180913211420_create_attribute_groups.rb
checking file db/migrate/20180913212008_create_attribute_group_fields.rb
checking file db/migrate/20190301162408_change_group_position_attributes.rb
checking file lib/redmine.rb
checking file lib/redmine/export/pdf/issues_pdf_helper.rb
Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #2 succeeded at 74 with fuzz 1 (offset 6 lines).
Hunk #3 FAILED at 85.
Hunk #4 FAILED at 101.
Hunk #5 succeeded at 147 with fuzz 2 (offset -46 lines).
Hunk #6 succeeded at 174 (offset -46 lines).
Hunk #7 succeeded at 202 (offset -46 lines).
Hunk #8 succeeded at 222 (offset -46 lines).
Hunk #9 FAILED at 297.
Hunk #10 succeeded at 278 (offset -46 lines).
Hunk #11 succeeded at 286 (offset -46 lines).
Hunk #12 succeeded at 294 (offset -46 lines).
Hunk #13 succeeded at 334 (offset -46 lines).
Hunk #14 succeeded at 347 (offset -46 lines).
Hunk #15 succeeded at 366 (offset -46 lines).
3 out of 15 hunks FAILED
checking file public/stylesheets/application.css
Hunk #1 succeeded at 476 (offset 1 line).
Hunk #2 succeeded at 1551 (offset 1 line).
checking file test/fixtures/attribute_group_fields.yml
checking file test/fixtures/attribute_groups.yml

I have another patch applied on field permissions. Does it mean they are not compatible?

Not exactly, see that most of the patch would apply, except for lib/redmine/export/pdf/issues_pdf_helper.rb

Also, you should not assume -R (revert), as the patch must be applied.

The problem is I have found whitespaces in the source file and tried to fix that with the patch (I shouldn' have tried it). Probably maintainers fixed that concurrently. The result is a file (before the patch) somewhat different, so the patch gives errors. You may edit that part out of the patch and apply it manually, it's not that difficult. Most hunks just delete whitespaces.

#19 Updated by Ivan Nikhayev 4 days ago

Does GCF-4.1.patch can be used for 4.1.1?

Also available in: Atom PDF