Unverified Commit 9117e72a authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(simpleplugin) Improve empty Date handling

issue #6152
Showing with 6 additions and 5 deletions
+6 -5
......@@ -44,9 +44,10 @@ class DateAttribute extends Attribute
function inputValue ($value)
{
if ($value === "" && !$this->isRequired()) {
return $value;
} elseif ($this->isTemplate() && preg_match('/%/', $value)) {
if (
($value === '') ||
($this->isTemplate() && preg_match('/%/', $value))
) {
return $value;
} else {
return $this->ldapToDate($value);
......@@ -55,7 +56,7 @@ class DateAttribute extends Attribute
function getValue ()
{
if ($this->value === "" && !$this->isRequired()) {
if ($this->value === '') {
return $this->value;
} else {
try {
......@@ -97,7 +98,7 @@ class DateAttribute extends Attribute
function computeLdapValue ()
{
if ($this->value === "" && !$this->isRequired()) {
if ($this->value === '') {
return $this->value;
} elseif (!($this->value instanceof DateTime)) {
try {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment