From 1a6b5892cbb7c5652248bd2c1e6af776fd30cd6d Mon Sep 17 00:00:00 2001 From: NativoDigital Date: Mon, 2 Jun 2025 20:13:12 +0200 Subject: [PATCH] Fix: allow null values for empty date fields in JCckTable::store() --- libraries/cck/_/table.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/libraries/cck/_/table.php b/libraries/cck/_/table.php index a6ef942cd..8ed0f95b7 100644 --- a/libraries/cck/_/table.php +++ b/libraries/cck/_/table.php @@ -104,5 +104,24 @@ public function storeIt() $this->check(); $this->store(); } + + public function store($updateNulls = false) + { + $fields = $this->getFields(); + foreach ($fields as $field => $definition) { + if ( + isset($this->$field) && + $this->$field === '' && + isset($definition->Type) && + stripos($definition->Type, 'date') !== false + ) { + $this->$field = null; + } + } + + return parent::store($updateNulls); + } + } -?> \ No newline at end of file +?> +