From e41a34858c210199ec9d96ac0c78eea88af4b345 Mon Sep 17 00:00:00 2001 From: Paul Weidner Date: Fri, 20 Oct 2023 10:42:32 -0700 Subject: [PATCH] Fix planting quick form creating empty quantities #737 --- CHANGELOG.md | 4 ++++ modules/quick/planting/src/Plugin/QuickForm/Planting.php | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a7b750bb..01fe381e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- [Fix planting quick form creating empty quantities #737](https://github.com/farmOS/farmOS/pull/737) + ## [2.2.1] 2023-10-09 ### Fixed diff --git a/modules/quick/planting/src/Plugin/QuickForm/Planting.php b/modules/quick/planting/src/Plugin/QuickForm/Planting.php index 58ebee819..577526baa 100644 --- a/modules/quick/planting/src/Plugin/QuickForm/Planting.php +++ b/modules/quick/planting/src/Plugin/QuickForm/Planting.php @@ -562,14 +562,14 @@ class Planting extends QuickFormBase { * @param array $values * Quantity field values from the form. * - * @return array - * Returns an array to pass into createLog() or createQuantity(). + * @return array|null + * Returns an array for createQuantity() or NULL if no quantity value. */ protected function prepareQuantity(array $values) { // If there is no value, return an empty array. if (empty($values['value'])) { - return []; + return NULL; } // If units is specified, then we need to convert it to units_id, which