Fixed Userfield value assignment handling (/objects/{entity} API endpoint) (fixes #1572)

This commit is contained in:
Bernd Bestel 2021-08-17 18:23:06 +02:00
parent 3608eec8fb
commit 61a58ddef0
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 2 additions and 1 deletions

View File

@ -8,4 +8,5 @@
- Fixed that grouping by columns in tables may caused duplicate groups
- Fixed that grocycode camera barcode scanning didn't recognize the scanned code for chore/battery tracking
- Fixed that `missing_products` of the `/stock/volatile` endpoint also returned incactive products
- Fixed that when having multiple Userfields for an entity, the `/objects/{entity}` endpoint returned wrong Userfield values
- Optimized the meal plan page to be properly printable (thanks @MrKrisKrisu)

View File

@ -161,7 +161,7 @@ class GenericEntityApiController extends BaseApiController
$userfieldKeyValuePairs = null;
foreach ($userfields as $userfield)
{
$value = FindObjectInArrayByPropertyValue($allUserfieldValues, 'object_id', $object->id);
$value = FindObjectInArrayByPropertyValue(FindAllObjectsInArrayByPropertyValue($allUserfieldValues, 'object_id', $object->id), 'name', $userfield->name);
if ($value)
{
$userfieldKeyValuePairs[$userfield->name] = $value->value;