Prevent undefined index notices

This commit is contained in:
Martijn 2016-10-20 14:04:15 +02:00 committed by Daniel Hensby
parent cbd3aa0949
commit 1ec56a1202
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E

View File

@ -213,14 +213,14 @@ abstract class ModelAdmin extends LeftAndMain {
if(is_array($params)) {
$params = ArrayLib::array_map_recursive('trim', $params);
}
// Parse all DateFields to handle user input non ISO 8601 dates
foreach($context->getFields() as $field) {
if($field instanceof DatetimeField) {
if($field instanceof DatetimeField && !empty($params[$field->getName()])) {
$params[$field->getName()] = date('Y-m-d', strtotime($params[$field->getName()]));
}
}
}
$list = $context->getResults($params);