Better handling of changing status & completed via context menu

This commit is contained in:
Nathan Gray 2015-07-28 14:37:57 +00:00
parent c6620e2115
commit 89bd82725d

View File

@ -1399,7 +1399,7 @@ class infolog_ui
$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 entries will get changed right back if we don't change the status too
if($entry['info_status'] == 'done') if(in_array($entry['info_status'],array('done','billed','cancelled','archive')))
{ {
$entry['info_status'] = 'ongoing'; $entry['info_status'] = 'ongoing';
} }
@ -1422,10 +1422,10 @@ class infolog_ui
if(isset($this->bo->status[$entry['info_type']][$settings])) if(isset($this->bo->status[$entry['info_type']][$settings]))
{ {
$action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings])); $action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings]));
if($settings != 'done' && $entry['info_status'] == 'done' && $entry['info_percent'] == 100) if(!in_array($settings,array('done','billed','cancelled','archive')) && $entry['info_percent'] == 100)
{ {
// Done entries will get changed right back if we don't change the completion too // Done entries will get changed right back if we don't change the completion too
$entry['info_percent'] = 99; $entry['info_percent'] = 90;
} }
$entry['info_status'] = $settings; $entry['info_status'] = $settings;
if($this->bo->write($entry, true,true,true,$skip_notifications)) if($this->bo->write($entry, true,true,true,$skip_notifications))