Fix changing status to archived changes completion

This commit is contained in:
Nathan Gray 2016-02-18 00:30:21 +00:00
parent ae79287e18
commit eeb2b8adcd

View File

@ -764,7 +764,7 @@ class infolog_bo
if ($status_only && !$undelete) // make sure only status gets writen
{
$set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set
(in_array($values['info_status'],array('done','billed','cancelled')) || (int)$values['info_percent'] == 100);
in_array($values['info_status'],array('done','billed','cancelled'));
$values = $old;
// only overwrite explicitly allowed fields
@ -800,7 +800,7 @@ class infolog_bo
if ($check_defaults)
{
if (!$values['info_datecompleted'] &&
(in_array($values['info_status'],array('done','billed')) || (int)$values['info_percent'] == 100))
(in_array($values['info_status'],array('done','billed'))))
{
$values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done
}
@ -813,7 +813,9 @@ class infolog_bo
{
$values['info_percent'] = 0;
}
else if ((int)$values['info_percent'] == 100 || $values['info_percent'] == 0)
else if (
($values['info_status'] != 'archive' && in_array($values['info_status'], $this->stock_status[$values['info_type']])) &&
((int)$values['info_percent'] == 100 || $values['info_percent'] == 0))
{
// We change percent to match status, not status to match percent
$values['info_percent'] = 10;