Fixed % handling in Userfield captions (fixes #2856)

This commit is contained in:
Bernd Bestel 2026-01-13 20:09:30 +01:00
parent 68b4abfac4
commit b1e3ef7881
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@
- Optimized the line plot markers color of the price history chart (product card) (thanks @DeepCoreSystem) - Optimized the line plot markers color of the price history chart (product card) (thanks @DeepCoreSystem)
- External barcode lookup plugin optimizations: - External barcode lookup plugin optimizations:
- When an image URL without a file extension ist returned, the file extension is now determined by the Content-Type header (if any) (thanks @jordy-u for the idea) - When an image URL without a file extension is returned, the file extension is now determined by the Content-Type header (if any) (thanks @jordy-u for the idea)
- Data URLs for images are now supported (`data:image/png;base64,xxxx`) (thanks @GammaC0de) - Data URLs for images are now supported (`data:image/png;base64,xxxx`) (thanks @GammaC0de)
- Fixed that German Umlauts were removed from product names when looking up a barcode via the built-in Open Food Facts external barcode lookup plugin - Fixed that German Umlauts were removed from product names when looking up a barcode via the built-in Open Food Facts external barcode lookup plugin
- Fixed that when using/scanning a barcode on the purchase page with a note attached (which prefills the note field) and when manually selecting another product afterwards, the note of the previously used barcode was incorrectly prefilled again - Fixed that when using/scanning a barcode on the purchase page with a note attached (which prefills the note field) and when manually selecting another product afterwards, the note of the previously used barcode was incorrectly prefilled again
@ -53,7 +53,7 @@
### Userfields ### Userfields
- xxx - Fixed that the corresponding form was broken when using a `%` in an Userfield caption (only affected numeric and date-time Userfields)
### General ### General

View File

@ -37,7 +37,7 @@
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_NUMBER_INT) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_NUMBER_INT)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => $userfield->name, 'id' => $userfield->name,
'label' => $userfield->caption, 'label' => str_replace('%', '%%', $userfield->caption), // Escape % (there are placeholders in Gettext translation strings)
'noNameAttribute' => true, 'noNameAttribute' => true,
'min' => 0, 'min' => 0,
'isRequired' => $userfield->input_required == 1, 'isRequired' => $userfield->input_required == 1,
@ -48,7 +48,7 @@
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_NUMBER_DECIMAL) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_NUMBER_DECIMAL)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => '', 'id' => '',
'label' => $userfield->caption, 'label' => str_replace('%', '%%', $userfield->caption), // Escape % (there are placeholders in Gettext translation strings)
'noNameAttribute' => true, 'noNameAttribute' => true,
'min' => 0, 'min' => 0,
'decimals' => 4, 'decimals' => 4,
@ -60,7 +60,7 @@
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_NUMBER_CURRENCY) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_NUMBER_CURRENCY)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => '', 'id' => '',
'label' => $userfield->caption, 'label' => str_replace('%', '%%', $userfield->caption), // Escape % (there are placeholders in Gettext translation strings)
'noNameAttribute' => true, 'noNameAttribute' => true,
'min' => 0, 'min' => 0,
'decimals' => 4, 'decimals' => 4,
@ -72,7 +72,7 @@
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATE) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATE)
@include('components.datetimepicker2', array( @include('components.datetimepicker2', array(
'id' => $userfield->name, 'id' => $userfield->name,
'label' => $userfield->caption, 'label' => str_replace('%', '%%', $userfield->caption), // Escape % (there are placeholders in Gettext translation strings)
'noNameAttribute' => true, 'noNameAttribute' => true,
'format' => 'YYYY-MM-DD', 'format' => 'YYYY-MM-DD',
'initWithNow' => false, 'initWithNow' => false,
@ -86,7 +86,7 @@
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATETIME) @elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_DATETIME)
@include('components.datetimepicker2', array( @include('components.datetimepicker2', array(
'id' => $userfield->name, 'id' => $userfield->name,
'label' => $userfield->caption, 'label' => str_replace('%', '%%', $userfield->caption), // Escape % (there are placeholders in Gettext translation strings)
'noNameAttribute' => true, 'noNameAttribute' => true,
'format' => 'YYYY-MM-DD HH:mm:ss', 'format' => 'YYYY-MM-DD HH:mm:ss',
'initWithNow' => false, 'initWithNow' => false,