diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 9f5841388..9e644f8c1 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -1822,16 +1822,17 @@ class SeedDMS_Search { /* {{{ */ $attributes = array(); foreach($attributes as $attrdefid=>$attribute) { - $attrdef = $this->dms->getAttributeDefinition($attrdefid); if($attribute) { - if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { - if(is_array($attribute)) { - if(!empty($attributes[$attrdefid]['from'])) - $attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from'])); - if(!empty($attributes[$attrdefid]['to'])) - $attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to'])); - } else { - $attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute)); + if($attrdef = $this->dms->getAttributeDefinition($attrdefid)) { + if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { + if(is_array($attribute)) { + if(!empty($attributes[$attrdefid]['from'])) + $attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from'])); + if(!empty($attributes[$attrdefid]['to'])) + $attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to'])); + } else { + $attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute)); + } } } }