Project

General

Profile

Actions

Patch #30919

open

Group Issues Custom Fields - (Form like Issues)

Added by Frederico Camara about 5 years ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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.


Files

GCF1.jpg (128 KB) GCF1.jpg Settings tab for Grouping Custom Fields Frederico Camara, 2019-02-25 16:58
GCF2.jpg (109 KB) GCF2.jpg Grouped Custom Fields in a new issue Frederico Camara, 2019-02-25 16:58
GCF3.jpg (160 KB) GCF3.jpg Grouped Custom Fields in a new issue (filled) Frederico Camara, 2019-02-25 16:58
GCF4.jpg (137 KB) GCF4.jpg Issue view with Grouped Custom Fields Frederico Camara, 2019-02-25 16:58
GCF-3.2.patch (21.8 KB) GCF-3.2.patch Frederico Camara, 2019-02-25 17:05
GCF-3.4.patch (25.7 KB) GCF-3.4.patch Frederico Camara, 2019-02-25 17:05
GCF-4.0.patch (26.3 KB) GCF-4.0.patch Frederico Camara, 2019-02-25 17:05
GCFep-4.0.patch (12.7 KB) GCFep-4.0.patch Frederico Camara, 2019-02-27 15:03
GCFep-3.4.patch (12.7 KB) GCFep-3.4.patch Frederico Camara, 2019-02-27 15:03
GCFep-3.2.patch (6.4 KB) GCFep-3.2.patch Frederico Camara, 2019-02-27 15:03
GCF-3.4-final1.patch (39.3 KB) GCF-3.4-final1.patch Frederico Camara, 2019-03-01 17:22
GCF-4.0-final1.patch (39.9 KB) GCF-4.0-final1.patch Frederico Camara, 2019-03-01 17:22
GCF-3.2-final1.patch (33.6 KB) GCF-3.2-final1.patch Frederico Camara, 2019-03-01 17:22
GCF-4.0-final1-fixed.patch (39.9 KB) GCF-4.0-final1-fixed.patch Fix for rails 5 or greater Frederico Camara, 2020-01-01 19:28
Snímek obrazovky 2020-01-05 v 9.58.02.png (42.9 KB) Snímek obrazovky 2020-01-05 v 9.58.02.png Petr Kokosak, 2020-01-05 09:59
Snímek obrazovky 2020-01-05 v 9.58.36.png (65.1 KB) Snímek obrazovky 2020-01-05 v 9.58.36.png Petr Kokosak, 2020-01-05 09:59
Snímek obrazovky 2020-01-05 v 9.58.52.png (46.4 KB) Snímek obrazovky 2020-01-05 v 9.58.52.png Petr Kokosak, 2020-01-05 09:59
GCF-4.1.patch (34.1 KB) GCF-4.1.patch For Redmine 4.1 Frederico Camara, 2020-04-17 23:02
group.png (10.9 KB) group.png Yuri Azanov, 2020-04-18 21:43
0001-Add-Group-Issue-Custom-Fields-functionality.patch (37.2 KB) 0001-Add-Group-Issue-Custom-Fields-functionality.patch For Redmine 4.2.1 Frederico Camara, 2021-07-28 16:12
issue_error_exporting_to_pdf.PNG (92.6 KB) issue_error_exporting_to_pdf.PNG Lúcia Rodrigues, 2021-08-23 18:41
0001-fix-pdf-generation-of-full-width-layout.patch (1.75 KB) 0001-fix-pdf-generation-of-full-width-layout.patch Apply over previous patches to fix pdf export (wide) Frederico Camara, 2021-08-23 21:12
group_issues_custom_fields.patch (37.6 KB) group_issues_custom_fields.patch port of patches to latest master branch philippe lhardy, 2024-01-20 12:59
attribute_category.5.1.1.0.1.tgz (18.3 KB) attribute_category.5.1.1.0.1.tgz attribute category plugin for 5.1.1 philippe lhardy, 2024-02-06 16:34

Related issues

Related to Redmine - Feature #35281: [Meta] (Issues) Custom (and Standard) Fields Grouping and PositioningNew

Actions
Actions #1

Updated by Frederico Camara about 5 years 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
Actions #2

Updated by Go MAEDA about 5 years ago

  • Target version set to Candidate for next major release
Actions #3

Updated by Frederico Camara about 5 years ago

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

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

Updated by Frederico Camara about 5 years 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
Actions #5

Updated by Zoltán Schmidt over 4 years 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'

Actions #6

Updated by Frederico Camara over 4 years 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
Actions #7

Updated by Petr Kokosak over 4 years 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

Actions #8

Updated by Frederico Camara over 4 years 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.

Actions #9

Updated by Yuri Azanov about 4 years ago

Can you make diff patch for redmine 4.1.0 please?

Actions #10

Updated by Frederico Camara about 4 years ago

Yuri Azanov wrote:

Can you make diff patch for redmine 4.1.0 please?

Here it is.

Actions #11

Updated by Yuri Azanov about 4 years 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

Actions #12

Updated by Frederico Camara about 4 years 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'.

Actions #13

Updated by Yuri Azanov about 4 years 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?

Actions #14

Updated by Frederico Camara about 4 years 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.

Actions #15

Updated by Yuri Azanov about 4 years 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...)

Actions #16

Updated by Adriano Bellia over 3 years 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?

Actions #17

Updated by Frederico Camara over 3 years 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.

Actions #18

Updated by Adriano Bellia over 3 years 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.

Actions #19

Updated by Ivan Nikhayev over 3 years ago

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

Actions #20

Updated by tonyq wang about 3 years ago

Ivan Nikhayev wrote:

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

It works in my 4.1.1 redmine.

Actions #21

Updated by Mischa The Evil almost 3 years ago

  • Related to Feature #35281: [Meta] (Issues) Custom (and Standard) Fields Grouping and Positioning added
Actions #22

Updated by Mischa The Evil almost 3 years ago

  • Target version deleted (Candidate for next major release)

Instead of scheduling this specific implementation proposal, I've scheduled the meta issue that I've just created.

Actions #23

Updated by Ben Huang over 2 years ago

Could you make diff patch for redmine 4.2.1 please?

Actions #25

Updated by Ben Huang over 2 years ago

Thanks for your quickly support, it works perfect in 4.2.1 Redmine.

Actions #26

Updated by Lúcia Rodrigues over 2 years ago

The Patch GCP-4.1 works perfectly, except with PDF exporting.
The long text fields appear in a single line, going beyond the page boundaries and being cut off, as demonstrated in attached image.

I checked that the patch applied all the changes to the file issues_pdf_helper.rb like it was supposed. Do you have any idea what it could be and how I can solve this problem?

Actions #27

Updated by Frederico Camara over 2 years ago

Lúcia Rodrigues,

Thanks for reporting. I think I fixed it in the code attached. Apply over previous patches.

Actions #28

Updated by Mischa The Evil over 2 years ago

FREDERICO LÚCIO DE SOUZA: First, thank you for sharing your solution with the broader Redmine community. I think that this would be a good improvement to the Redmine core for instances (with projects) that use a larger amount of custom fields. I'm at the moment actually considering to start a new project which could really benefit from this feature.

I have had a quick look at your patches (more specifically: 0001-Add-Group-Issue-Custom-Fields-functionality.patch) and have some questions and remarks though:
  • How does the design of the implementation you've chosen for your patches compare to the design of the patch that is provided in #13839#note-8?
  • Did you choose the name groupissuescustomfields on purpose? Rails convention tends to lean more towards something like group_issues_custom_fields. I noticed that this seems a recurring theme with some more variables like tid, gid, cfid, gp, cfs, cfp, etc.
  • Where are full-width custom fields actually placed after your patch has been applied?
  • In which cases is the wiki formatting toolbar actually provided?
  • In the screenshots you've posted it looks like the right borders of field inputs are cutoff. I don't think that's intentional. Is this still present?
  • Do you see a way to extent this patch to also allow for grouping of default fields?
  • Can you update the patch to apply to the (current) trunk?
  • Can you confirm if the current test suite passes without failures/errors with your patch applied?
  • Can you provide (solid) test coverage for your changes (this would be required to get it integrated within the Redmine core)?
Actions #29

Updated by Frederico Camara over 2 years ago

Mischa The Evil wrote:

  • How does the design of the implementation you've chosen for your patches compare to the design of the patch that is provided in #13839#note-8?

I did not know about #13839#note-8 before writing my own. I downloaded #13839#note-8 and tried to apply it with Redmine stable from 3.0 to 4.2 but it shows errors. I have not tried to merge that patch. Just reading it, I noticed some differences:
Both patches do similar things, but there are differences:
#13839#note-8 saves changes as json to a new model, and there is no db migration code. Is it missing?
#13839#note-8 changes the layout and could insert blanks between fields. It does not group them. It has no full width code (maybe it's older then full width fields).
My patch (this one) is somewhat broader, it also works with pdf export and mail.
Neither patch seems to copy itself when copying a project (at least this doesn't).
I haven't seen how #13839#note-8 deals with adding/removing custom fields to/from a project/tracker.

  • Did you choose the name groupissuescustomfields on purpose? Rails convention tends to lean more towards something like group_issues_custom_fields. I noticed that this seems a recurring theme with some more variables like tid, gid, cfid, gp, cfs, cfp, etc.

No, it's plain inexperience with Rails convention. Easy fix, though.

  • Where are full-width custom fields actually placed after your patch has been applied?

What I do is mix them (full-width custom fields) inbetween two column fields. They interrupt the flow of two column fields, go full width, and then the flow continues.
I just didn't like full-width custom fields being at the bottom.

Let me give an ordered example, how it works (comma separated fields are full with when they end with a 'w')
Group A: f1, f2, f3w, f4, f5, f6, f7w, f8w f9; the layout would be:
Group A
f1 f2
f3w
f4 f6
f5
f7w
f8w
f9
  • In which cases is the wiki formatting toolbar actually provided?

As usual. If the formatting toolbar is set for the custom field, it shows above it, when editing the issue.

  • In the screenshots you've posted it looks like the right borders of field inputs are cutoff. I don't think that's intentional. Is this still present?

Could not reproduce it now. Maybe I fixed it after I took the screenshots, or the screenshots were (badly) edited for size. I can't recall, it was so long ago.

  • Do you see a way to extent this patch to also allow for grouping of default fields?

I never thought of that.
Custom fields's layout are a loop. I divide them in 3 categories: Redmine ordered, ordered but not grouped, grouped. I show these categories in that order.
Before layouting I know which custom fields would show.
Default fields code is different, the order and layout are hardcoded. I would have to break that into the layouting code, and the db layout points to the custom_field table.
Also, what if I add new fields to a project/tracker, should I put them at the end? If so I would have to mark they are ungrouped somehow, or else they would seem to be part of the last group.

  • Can you update the patch to apply to the (current) trunk?

Yes, if it doesn't already.

  • Can you confirm if the current test suite passes without failures/errors with your patch applied?

No, I can't. I use about a dozen plugins in production here, tests always fail. It may pass, I don't know if tests really care about the ordering of custom fields.

  • Can you provide (solid) test coverage for your changes (this would be required to get it integrated within the Redmine core)?

I don't know if I have the skill. Maybe, I can try.

Actions #30

Updated by Lúcia Rodrigues over 2 years ago

Frederico Camara wrote:

Lúcia Rodrigues,

Thanks for reporting. I think I fixed it in the code attached. Apply over previous patches.

Thank you Frederico for your quick support.
This fix works perfectly.

Actions #31

Updated by philippe lhardy 3 months ago

To pursue a current request for custom_fields grouping i ported 4.2.1 patches (pdf too) on current master branch.
i quickly checked it was working, this cannot be consedered as correctly tested.
If it can help ... For overall context see https://www.redmine.org/boards/1/topics/69072.

Actions #32

Updated by philippe lhardy 3 months ago

Previous patch port to master does nothing visible, i have to fix.
It does work, groups are by project and by tracker id, i just did select the wrong tracker.

Actions #33

Updated by Frederico Camara 3 months ago

philippe lhardy wrote in #note-32:

Previous patch port to master does nothing visible, i have to fix.
It does work, groups are by project and by tracker id, i just did select the wrong tracker.

Thank you. I made a patch to copy the issue layout when copying the project:

From 3158c5c4b21b5a72184bf61272950593f4dc2a9c Mon Sep 17 00:00:00 2001
From: Frederico Camara <frederico.camara@serpro.gov.br>
Date: Tue, 23 Jan 2024 12:37:22 -0300
Subject: [PATCH] Copy issue layout when copying a project

---
 app/models/project.rb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/models/project.rb b/app/models/project.rb
index 71a06d320..a3224d21d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -871,6 +871,13 @@ class Project < ActiveRecord::Base
           attachment.copy(:container => self)
         end

+        project.attribute_groups.map{|x| {tracker_id: x.tracker_id, name: x.name, cfs: x.attribute_group_fields.pluck(:custom_field_id)}}.each_with_index do |x, xi|
+          xid = AttributeGroup.create(project_id: self.id, tracker_id: x[:tracker_id], name: x[:name], position: xi).id
+          x[:cfs].each_with_index do |c, ci|
+            AttributeGroupField.create(attribute_group_id: xid, custom_field_id: c, position: ci)
+          end
+        end
+
         to_be_copied.each do |name|
           send "copy_#{name}", project
         end
-- 
2.34.1

It can be applied over my previous patches (for redmine 4.1, maybe others), if you'd like.

Actions #34

Updated by philippe lhardy 2 months ago

Thanks Frederico,

I didn't integrate your last update for clone yet, but i reused your work and mixed with other to match a request from Orange to create a plugin to group custom fields and add potential static description.

this plugin is mixing those and was applied on latest master.

- https://www.redmine.org/issues/39530
- https://www.redmine.org/issues/40084
- https://www.redmine.org/issues/30919

As a very recent code this is to be used with care, it was not extensively tested.

Actions #35

Updated by Jérôme Gallot 2 months ago

philippe lhardy wrote in #note-34:

Thanks Frederico,

I didn't integrate your last update for clone yet, but i reused your work and mixed with other to match a request from Orange to create a plugin to group custom fields and add potential static description.

this plugin is mixing those and was applied on latest master.

- https://www.redmine.org/issues/39530
- https://www.redmine.org/issues/40084
- https://www.redmine.org/issues/30919

As a very recent code this is to be used with care, it was not extensively tested.

Hi Philippe,
Haven't you got a git repository ? it will be better to share improvements and feedbacks ?
It may be good to add licensing information (GPL ?) too.

which versions of Redmine are supported ? 5.X ? 5.1.X ?

Best Regards

Actions #36

Updated by philippe lhardy 2 months ago

Hi Jérôme,

I rather prefer to discuss in forum : https://www.redmine.org/boards/1/topics/69072.

Kind regards,

Actions

Also available in: Atom PDF