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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit fd25828048)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 2872ebe3d4)
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
This commit is contained in:
Owen Leonard 2023-10-31 13:48:11 +00:00 committed by Pedro Amorim
parent 1a04d21a71
commit 5dc358fb23

View file

@ -89,7 +89,7 @@
<div class="blocks">
<select name="agefield_[% id | html %]">
<option value="">Choose an age field</option>
[% FOR field IN agefields %]
[% FOR field IN agefields.sort %]
[% IF rule.agefield == field %]
<option value="[% field | html %]" selected="selected">[% field | html %]</option>
[% ELSE %]
@ -106,7 +106,7 @@
<div class="block">
<select name="condition_field_[% id | html %]">
<option value="">Choose a field name</option>
[% FOR field IN condition_fields %]
[% FOR field IN condition_fields.sort %]
[% IF condition.field == field %]
<option value="[% field | html %]" selected="selected">[% field | html %]</option>
[% ELSE %]
@ -127,7 +127,7 @@
<div class="block">
<select class="required" required="required" name="substitution_field_[% id | html %]">
<option value="">Choose a field name</option>
[% FOR field IN substitution_fields %]
[% FOR field IN substitution_fields.sort %]
[% IF substitution.field == field %]
<option value="[% field | html %]" selected="selected">[% field | html %]</option>
[% ELSE %]
@ -164,7 +164,7 @@
<div class="block">
<select name="agefield">
<option value="">Choose an age field</option>
[% FOR field IN agefields %]
[% FOR field IN agefields.sort %]
<option value="[% field | html %]">[% field | html %]</option>
[% END %]
</select>
@ -176,7 +176,7 @@
<div class="block">
<select name="condition_field">
<option value="">Choose a field name</option>
[% FOR field IN condition_fields %]
[% FOR field IN condition_fields.sort %]
<option value="[% field | html %]">[% field | html %]</option>
[% END %]
</select>
@ -191,7 +191,7 @@
<div class="block">
<select required="required" class="required" name="substitution_field">
<option value="">Choose a field name</option>
[% FOR field IN substitution_fields %]
[% FOR field IN substitution_fields.sort %]
<option value="[% field | html %]">[% field | html %]</option>
[% END %]
</select>