Apply status / percent rules for changing percent via context menu

This commit is contained in:
Nathan Gray 2015-12-07 18:53:08 +00:00
parent 163e1fdcc2
commit 20e23b811e

View File

@ -1409,8 +1409,8 @@ class infolog_ui
case 'completion': case 'completion':
$action_msg = lang('changed completion to %1%', $settings); $action_msg = lang('changed completion to %1%', $settings);
$entry['info_percent'] = $settings; $entry['info_percent'] = $settings;
// Done entries will get changed right back if we don't change the status too // Done and not-started entries will get changed right back if we don't change the status too
if(in_array($entry['info_status'],array('done','billed','cancelled','archive'))) if(in_array($entry['info_status'],array('not-started','done','billed','cancelled','archive')))
{ {
$entry['info_status'] = 'ongoing'; $entry['info_status'] = 'ongoing';
} }
@ -1418,6 +1418,10 @@ class infolog_ui
{ {
$entry['info_status'] = 'not-started'; $entry['info_status'] = 'not-started';
} }
else if ($entry['info_percent'] == 100)
{
$entry['info_status'] = 'done';
}
if($this->bo->write($entry, true,true,true,$skip_notifications)) if($this->bo->write($entry, true,true,true,$skip_notifications))
{ {
$success++; $success++;