diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index bf8fac22..18e68f9d 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -119,6 +119,7 @@ ### Userfield improvements/fixes - New Userfield type "File" to attach any file, will be rendered as a link to the file in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc) - New Userfield type "Picture" to attach a picture, the picture will be rendered (small) in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc) +- Userfields can now be reordered on the input form (new field "Sort number" per Userfield, fields will be ordered by that number, if any) ### General & other improvements/fixes - UI refresh / style improvements (thanks @zsarnett for the idea and initial work on this) diff --git a/localization/strings.pot b/localization/strings.pot index 6b37a831..7845fdd8 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1975,3 +1975,18 @@ msgstr "" msgid "Automatically do the booking using the last price and the amount of the shopping list item, if the product has \"Default due days\" set" msgstr "" + +msgid "When moving products from/to a freezer location, the products due date is automatically adjusted according to the product settings" +msgstr "" + +msgid "This is the internal field name, e. g. for the API" +msgstr "" + +msgid "This is used to display the field on the frontend" +msgstr "" + +msgid "Multiple Userfields will be ordered by that number on the input form" +msgstr "" + +msgid "Sort number" +msgstr "" diff --git a/migrations/0119.sql b/migrations/0119.sql new file mode 100644 index 00000000..5980b6e4 --- /dev/null +++ b/migrations/0119.sql @@ -0,0 +1,2 @@ +ALTER TABLE userfields +ADD sort_number INTEGER; diff --git a/services/UserfieldsService.php b/services/UserfieldsService.php index 8383e9b3..bed0e326 100644 --- a/services/UserfieldsService.php +++ b/services/UserfieldsService.php @@ -65,7 +65,7 @@ class UserfieldsService extends BaseService throw new \Exception('Entity does not exist or is not exposed'); } - return $this->getDatabase()->userfields()->where('entity', $entity)->orderBy('name', 'COLLATE NOCASE')->fetchAll(); + return $this->getDatabase()->userfields()->where('entity', $entity)->orderBy('sort_number')->orderBy('name', 'COLLATE NOCASE')->fetchAll(); } public function GetValues($entity, $objectId) diff --git a/views/userfieldform.blade.php b/views/userfieldform.blade.php index 458b7083..da50f38e 100644 --- a/views/userfieldform.blade.php +++ b/views/userfieldform.blade.php @@ -49,7 +49,12 @@
- +
- + {{ $__t('A caption is required') }}
+ @include('components.numberpicker', array( + 'id' => 'sort_number', + 'label' => 'Sort number', + 'min' => 0, + 'value' => $userfield->sort_number, + 'isRequired' => false, + 'hint' => $__t('Multiple Userfields will be ordered by that number on the input form') + )) +