Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MyvTsv committed Jan 29, 2025
1 parent 6f8c10d commit e15aa3e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions inc/field/fieldsfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,7 @@ public function prepareHtmlField($fieldName, $canedit = true, $value = '') {
$field['value'] = $value;
} else {
//get default value
if (
$this->getField()->fields['default_value'] !== ""
&& $this->getField()->fields['default_value'] !== null
&& $this->getField()->fields['default_value'] !== 0
) {
if (!empty($this->getField()->fields['default_value'])) {
$value = $this->getField()->fields['default_value'];
// shortcut for date/datetime
if (in_array($this->getField()->fields['type'], ['date', 'datetime'])
Expand Down Expand Up @@ -512,7 +508,7 @@ public function isValid(): bool {
private function isAdditionalFieldEmpty(): bool {
switch ($this->getField()->fields['type']) {
case 'dropdown':
return $this->getField()->fields['mandatory'] && ($this->value == 0 || $this->value == '' || $this->value == null);
return $this->getField()->fields['mandatory'] && empty($this->value);
}

return $this->getField()->fields['mandatory'] && $this->value == '';
Expand Down

0 comments on commit e15aa3e

Please sign in to comment.