From c987e5b0135446ec222ff23fe89c4ba59d3ec9bd Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 25 Jul 2016 14:56:39 -0600 Subject: [PATCH] Do not allow due or finish before start when copying from projectmanager template --- infolog/inc/class.infolog_datasource.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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;