From 80600be607378a451778f9fd114d2dbf903776eb Mon Sep 17 00:00:00 2001 From: Ronny Grobel Date: Fri, 17 Apr 2026 17:44:36 +0200 Subject: [PATCH] Fix is_mandatory checkbox not saving when unchecked --- includes/Admin/Admin.php | 1 + includes/Validator.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/Admin/Admin.php b/includes/Admin/Admin.php index 1146cad..d05c303 100644 --- a/includes/Admin/Admin.php +++ b/includes/Admin/Admin.php @@ -1377,6 +1377,7 @@ class Admin { diff --git a/includes/Validator.php b/includes/Validator.php index f0c1d02..049ed80 100644 --- a/includes/Validator.php +++ b/includes/Validator.php @@ -259,7 +259,7 @@ class Validator { $unit_amount = isset( $data['unit_amount'] ) ? str_replace( ',', '.', wp_unslash( $data['unit_amount'] ) ) : ''; $entry_year = $this->sanitize_cost_year( $data ); $distribution_type = sanitize_key( wp_unslash( isset( $data['distribution_type'] ) ? $data['distribution_type'] : 'parcel' ) ); - $is_mandatory = isset( $data['is_mandatory'] ) ? (bool) $data['is_mandatory'] : true; + $is_mandatory = isset( $data['is_mandatory'] ) && '1' === (string) wp_unslash( $data['is_mandatory'] ); return array( 'entry_year' => $entry_year,