Do not allow due or finish before start when copying from projectmanager template

This commit is contained in:
nathangray 2016-07-25 14:56:39 -06:00
parent 0405eb1510
commit c987e5b013

View File

@ -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'); $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; if(!($info['info_id'] = $this->infolog_bo->write($info))) return false;