From 6e25cb5b908d9fc8d0647e66ac2298ab53b0d3e6 Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 26 Mar 2025 14:37:22 +0100 Subject: [PATCH 1/3] Fix validation for mandatory multiple dropdown --- inc/container.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/container.class.php b/inc/container.class.php index 93c9de2c..5545eff3 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1523,6 +1523,7 @@ public static function validateValues($data, $itemtype, $massiveaction) && ( $value === null || $value === '' + || (is_array($value) && empty($value)) || (($field['type'] === 'dropdown' || preg_match('/^dropdown-.+/i', $field['type'])) && $value == 0) || (in_array($field['type'], ['date', 'datetime']) && $value == 'NULL') ) From 5eda459d7831eacad31848bab1be99e5a81bc61b Mon Sep 17 00:00:00 2001 From: RomainLvr Date: Wed, 26 Mar 2025 14:38:53 +0100 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ea23464..cbab0fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [UNRELEASE] +### Fixed + +- Fix validation for mandatory multiple dropdown + ## [1.21.21] - 2025-03-21 ### Fixed From ccc57f5b0e67f4550d4aca794316e8ad9af1521d Mon Sep 17 00:00:00 2001 From: Romain Lecouvreur <102067890+RomainLvr@users.noreply.github.com> Date: Wed, 26 Mar 2025 15:31:02 +0100 Subject: [PATCH 3/3] Update inc/container.class.php Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com> --- inc/container.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/inc/container.class.php b/inc/container.class.php index 5545eff3..d8cc983f 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1521,9 +1521,7 @@ public static function validateValues($data, $itemtype, $massiveaction) if ( $field['mandatory'] == 1 && ( - $value === null - || $value === '' - || (is_array($value) && empty($value)) + empty($value) || (($field['type'] === 'dropdown' || preg_match('/^dropdown-.+/i', $field['type'])) && $value == 0) || (in_array($field['type'], ['date', 'datetime']) && $value == 'NULL') )