diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php index ad794304e6..f5884019b9 100644 --- a/infolog/inc/class.infolog_bo.inc.php +++ b/infolog/inc/class.infolog_bo.inc.php @@ -804,10 +804,20 @@ class infolog_bo { $values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done } + // Check for valid status / percent combinations if (in_array($values['info_status'],array('done','billed'))) { $values['info_percent'] = 100; } + else if (in_array($values['info_status'], array('not-started'))) + { + $values['info_percent'] = 0; + } + else if ((int)$values['info_percent'] == 100 || $values['info_percent'] == 0) + { + // We change percent to match status, not status to match percent + $values['info_percent'] = 10; + } if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'],array('done','billed','cancelled','archive'))) { //echo "check_defaults:"; _debug_array($this->status[$values['info_type']]); diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 1d1c4f22e4..7bf742a448 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1845,7 +1845,23 @@ class infolog_ui if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']])) { $content['info_status'] = $this->bo->status['defaults'][$content['info_type']]; - if ($content['info_status'] != 'done') $content['info_datecompleted'] = ''; + // Make sure we don't end up with invalid status / percent combinations + if ($content['info_status'] != 'done') + { + $content['info_datecompleted'] = ''; + if((int)$content['info_percent'] === 100) + { + $content['info_percent'] = 10; + } + } + else + { + $content['info_percent'] = 100; + } + if($content['info_status'] != 'not-started' && (int)$content['info_percent'] == 0) + { + $content['info_percent'] = 10; + } } } else // new call via GET