improve type-filter in customfield list to be able to select fields for all type and always show the fields for all types too, when a certain type is select

This commit is contained in:
ralf 2024-09-16 15:10:12 +02:00
parent b1789c062f
commit 8c7547f056
3 changed files with 21 additions and 4 deletions

View File

@ -239,7 +239,7 @@ class admin_customfields
}
$this->types2[$type] = $entry['name'];
}
$sel_options['types'] = $sel_options['cf_type2'] = $this->types2;
$sel_options['types'] = $sel_options['cf_type2'] = ['~~all~~' => lang('All')]+$this->types2;
$content['type_template'] = $this->appname . '.admin.types';
$content['content_types']['appname'] = $this->appname;
@ -756,8 +756,25 @@ class admin_customfields
$rows = array();
$query['col_filter']['cf_app'] = $query['appname'];
if (!empty($t2=$query['col_filter']['cf_type2']))
{
if ($t2 === '~~all~~')
{
$query['col_filter'][0] = 'cf_type2 IS NULL';
}
else
{
$query['col_filter'][0] = '(cf_type2 IS NULL OR cf_type2='.$GLOBALS['egw']->db->quote($t2).')';
}
unset($query['col_filter']['cf_type2']);
}
$total = $this->so->get_rows($query, $rows, $readonlys);
unset($query['col_filter']['cf_app']);
if (isset($t2))
{
unset($query['col_filter'][0]);
$query['col_filter']['cf_type2'] = $t2;
}
foreach($rows as &$row)
{

View File

@ -12,7 +12,7 @@
<rows>
<row disabled="@no_types">
<et2-description value="Type"></et2-description>
<et2-select span="3" id="cf_type2" rows="5" multiple="1" noLang="1"></et2-select>
<et2-select span="3" id="cf_type2" rows="5" multiple="true" placeholder="All" noLang="1"></et2-select>
</row>
<row>
<et2-description value="Label"></et2-description>
@ -33,7 +33,7 @@
</row-->
<row>
<et2-description statustext="each value is a line like id[=label], or use @path to read options from a file in EGroupware directory" value="Options"></et2-description>
<et2-textarea statustext="@statustext" id="cf_values" rows="5" size="30" span="3" width="99%"></et2-textarea>
<et2-textarea statustext="@statustext" id="cf_values" rows="5" span="3" width="99%"></et2-textarea>
</row>
<row>
<et2-description value="Length"></et2-description>

View File

@ -2010,7 +2010,7 @@ class infolog_ui
}
}
// on a type-change, set the status to the default status of that type, if the actual status is not supported by the new type
if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']]))
if (!array_key_exists($content['info_status'],$this->bo->status[$content['info_type']] ?? []))
{
$content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
// Make sure we don't end up with invalid status / percent combinations