- Fix custom type & status filters giving wrong results

- Fix changing type with a custom status could lead to an invalid status for the new type
This commit is contained in:
Nathan Gray 2015-11-17 19:33:52 +00:00
parent 296d39a83a
commit c8478e0635
2 changed files with 11 additions and 2 deletions

View File

@ -752,6 +752,15 @@ class infolog_bo
{
return false;
}
// Make sure status is still valid if the type changes
if($old['info_type'] != $values['info_type'] && $values['info_status'])
{
if(!in_array($values['info_status'], array_keys($this->status[$values['info_type']])))
{
$values['info_status'] = $this->status['defaults'][$values['info_type']];
}
}
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
@ -833,7 +842,7 @@ class infolog_bo
$custom = egw_customfields::get('infolog');
foreach($custom as $c_name => $c_field)
{
if($c_field['type2']) $type2 = explode(',',$c_field['type2']);
if($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',',$c_field['type2']);
if($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'],$type2)))
{
// Required custom field

View File

@ -405,7 +405,7 @@ class infolog_ui
}
// If status is not valid for selected type, clear status filter
if($query['col_filter']['info_status'] && $query['col_filter']['info_status'] != 'deleted' &&
!in_array($query['col_filter']['info_status'], $this->bo->status[$query['col_filter']['info_type']]))
!in_array($query['col_filter']['info_status'], array_keys($this->bo->status[$query['col_filter']['info_type']])))
{
$query['col_filter']['info_status'] = '';
}