forked from extern/egroupware
Some more checks to avoid invalid status / percent combinations
- changing type in edit dialog, and need to load default status for new type - changing status via context menu
This commit is contained in:
parent
6124a7fc21
commit
f650d8b5fe
@ -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']]);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user