diff --git a/infolog/inc/class.infolog_datasource.inc.php b/infolog/inc/class.infolog_datasource.inc.php index 6b9813a4c0..d0148fd57b 100644 --- a/infolog/inc/class.infolog_datasource.inc.php +++ b/infolog/inc/class.infolog_datasource.inc.php @@ -138,6 +138,15 @@ class infolog_datasource extends datasource $info[$info_field] = date_add(new Api\DateTime($info[$info_field]), $date_offsets[$offset_field])->format('ts'); } } + // Sanity check - not due or ended before it starts + if($info['info_startdate'] && $info['info_enddate'] && $info['info_startdate'] > $info['info_enddate']) + { + unset($info['info_enddate']); + } + if($info['info_startdate'] && $info['info_datecompleted'] && $info['info_startdate'] > $info['info_datecompleted']) + { + unset($info['info_datecompleted']); + } if(!($info['info_id'] = $this->infolog_bo->write($info))) return false;