Bug 35198

Summary: Sort database column names alphabetically on automatic item modification page
Product: Koha Reporter: Owen Leonard <oleonard>
Component: CatalogingAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrew.auld, fridolin.somers, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.06,22.11.12
Circulation function:
Attachments: Bug 35198: Sort database column names alphabetically on automatic item modification page
Bug 35198: Sort database column names alphabetically on automatic item modification page
Bug 35198: Sort database column names alphabetically on automatic item modification page

Description Owen Leonard 2023-10-31 13:47:34 UTC
In Cataloging -> Automatic item modifications by age, when adding or editing a rule there are several dropdowns for selecting which column in the items or biblioitems tables to use. These lists are currently not in alphabetical order, making it hard to locate the field you want.

We can add the Template::Toolkit "sort" method to sort them alphabetically.
Comment 1 Owen Leonard 2023-10-31 13:54:25 UTC
Created attachment 158120 [details] [review]
Bug 35198: Sort database column names alphabetically on automatic item modification page

This patch modifies the automatic item modification by age page so that
the rule entry form sorts <select>s alphabetically, making it easier to
find the entry you need.

The [% FOR field IN... %] directives now include the "sort" method, e.g.

    [% FOR field IN agefields.sort %]

To test, apply the patch and go to Cataloging -> Item modifications by
age

- Click the "Add rules" button, then the "Add rule" button.
- Check the "Age field," "Conditions," and "Substitutions" dropdowns to
  confirm that the choices are listed alphabetically.
- Fill in the form and save the rule.
- Go back and edit the rule you created. Check that the dropdowns are
  still correct.
Comment 2 PTFS Europe Sandboxes 2023-11-01 12:24:38 UTC
Created attachment 158176 [details] [review]
Bug 35198: Sort database column names alphabetically on automatic item modification page

This patch modifies the automatic item modification by age page so that
the rule entry form sorts <select>s alphabetically, making it easier to
find the entry you need.

The [% FOR field IN... %] directives now include the "sort" method, e.g.

    [% FOR field IN agefields.sort %]

To test, apply the patch and go to Cataloging -> Item modifications by
age

- Click the "Add rules" button, then the "Add rule" button.
- Check the "Age field," "Conditions," and "Substitutions" dropdowns to
  confirm that the choices are listed alphabetically.
- Fill in the form and save the rule.
- Go back and edit the rule you created. Check that the dropdowns are
  still correct.

Signed-off-by: Andrew Auld <andrew.auld@ptfs-europe.com>
Comment 3 Andrew Auld 2023-11-01 12:25:54 UTC
Brilliant job Owen, works perfectly!
Comment 4 Katrin Fischer 2023-11-01 22:49:11 UTC
Created attachment 158225 [details] [review]
Bug 35198: Sort database column names alphabetically on automatic item modification page

This patch modifies the automatic item modification by age page so that
the rule entry form sorts <select>s alphabetically, making it easier to
find the entry you need.

The [% FOR field IN... %] directives now include the "sort" method, e.g.

    [% FOR field IN agefields.sort %]

To test, apply the patch and go to Cataloging -> Item modifications by
age

- Click the "Add rules" button, then the "Add rule" button.
- Check the "Age field," "Conditions," and "Substitutions" dropdowns to
  confirm that the choices are listed alphabetically.
- Fill in the form and save the rule.
- Go back and edit the rule you created. Check that the dropdowns are
  still correct.

Signed-off-by: Andrew Auld <andrew.auld@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi (tcohen) 2023-11-08 14:43:02 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-11-10 21:13:31 UTC
Small enhancement, I choose to backport.

Pushed to 23.05.x for 23.05.06
Comment 7 Pedro Amorim 2023-11-14 14:50:24 UTC
Nice work everyone!

Pushed to 22.11.x for next release