Fix planting quick form creating empty quantities #737

This commit is contained in:
Paul Weidner 2023-10-20 10:42:32 -07:00 committed by Michael Stenta
parent 6657a88254
commit e41a34858c
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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