Fix is_mandatory checkbox not saving when unchecked

This commit is contained in:
2026-04-17 17:44:36 +02:00
parent 6b15d7b2a1
commit 80600be607
2 changed files with 2 additions and 1 deletions

View File

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