Fix planting quick form creating empty quantities #737
This commit is contained in:
parent
6657a88254
commit
e41a34858c
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- [Fix planting quick form creating empty quantities #737](https://github.com/farmOS/farmOS/pull/737)
|
||||||
|
|
||||||
## [2.2.1] 2023-10-09
|
## [2.2.1] 2023-10-09
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -562,14 +562,14 @@ class Planting extends QuickFormBase {
|
||||||
* @param array $values
|
* @param array $values
|
||||||
* Quantity field values from the form.
|
* Quantity field values from the form.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array|null
|
||||||
* Returns an array to pass into createLog() or createQuantity().
|
* Returns an array for createQuantity() or NULL if no quantity value.
|
||||||
*/
|
*/
|
||||||
protected function prepareQuantity(array $values) {
|
protected function prepareQuantity(array $values) {
|
||||||
|
|
||||||
// If there is no value, return an empty array.
|
// If there is no value, return an empty array.
|
||||||
if (empty($values['value'])) {
|
if (empty($values['value'])) {
|
||||||
return [];
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If units is specified, then we need to convert it to units_id, which
|
// If units is specified, then we need to convert it to units_id, which
|
||||||
|
|
Loading…
Reference in New Issue