mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-30 18:49:24 +01:00
Added filter to list, which allows to show infologs linked to an entry
of any other applications, eg: - infologs linked to a certain project - infologs linked to a contact
This commit is contained in:
parent
a11a04b78d
commit
00ca396066
infolog
inc
setup
templates/default
@ -1413,26 +1413,4 @@ class infolog_bo
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* returns array with relation link_id and info_id (necessary for project-selection)
|
||||
*
|
||||
* @param int $pm_id ID of selected project
|
||||
* @return array containing link_id and info_id
|
||||
*/
|
||||
function get_pm_infolog_links($pm_id=0)
|
||||
{
|
||||
if($pm_id && isset($GLOBALS['egw_info']['user']['apps']['projectmanager']))
|
||||
{
|
||||
$pm_ids = ExecMethod('projectmanager.projectmanager_bo.children',$pm_id);
|
||||
$pm_ids[] = $pm_id;
|
||||
$links = solink::get_links('projectmanager',$pm_ids,'infolog'); // solink::get_links not egw_links::get_links!
|
||||
if ($links)
|
||||
{
|
||||
$links = array_unique(call_user_func_array('array_merge',$links));
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -297,22 +297,21 @@ class infolog_ui
|
||||
{
|
||||
$query['csv_fields'] = $this->csv_export_fields($query['col_filter']['info_type']);
|
||||
}
|
||||
if ($query['col_filter']['pm_id'])
|
||||
//search for projects (project manager filter)
|
||||
if ((string)$query['col_filter']['pm_id'] != '')
|
||||
// handle linked filter (show only entries linked to a certain other entry)
|
||||
unset($query['col_filter']['info_id']);
|
||||
if ($query['col_filter']['linked'])
|
||||
{
|
||||
$query['col_filter']['info_id'] = $this->bo->get_pm_infolog_links($query['col_filter']['pm_id']);
|
||||
if (!$query['col_filter']['info_id']) $query['col_filter']['info_id'][] = 0;
|
||||
$project = $query['col_filter']['pm_id'];
|
||||
unset($query['col_filter']['pm_id']);
|
||||
list($app,$id) = explode(':',$query['col_filter']['linked']);
|
||||
if (!($links = egw_link::get_links($app,$id,'infolog')))
|
||||
{
|
||||
$rows = array(); // no infologs linked to project --> no rows to return
|
||||
return 0;
|
||||
}
|
||||
$query['col_filter']['info_id'] = array_values(array_unique($links));
|
||||
$linked = $query['col_filter']['linked'];
|
||||
}
|
||||
if ((string)$query['col_filter']['pm_id'] != '' && (string)$query['col_filter']['pm_id'] == '0')
|
||||
{
|
||||
$no_projects = true; //to select later the infologs without any projects
|
||||
$project = $query['col_filter']['pm_id'];
|
||||
unset($query['col_filter']['info_id']);
|
||||
}
|
||||
unset($query['col_filter']['pm_id']);
|
||||
unset($query['col_filter']['linked']);
|
||||
|
||||
// check if we have a custom, type-specific template
|
||||
unset($query['template']);
|
||||
unset($query['custom_fields']);
|
||||
@ -384,17 +383,8 @@ class infolog_ui
|
||||
unset($info['info_des']);
|
||||
}
|
||||
}
|
||||
if (!$no_projects) //searchfilter for projects
|
||||
{
|
||||
$rows[] = $info;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$info['pm_id']) $rows[] = $info; //ony if we have no projects linked
|
||||
}
|
||||
$rows[] = $info;
|
||||
}
|
||||
if ($no_projects) $query['total'] = count($rows);
|
||||
unset($no_projects);
|
||||
unset($links);
|
||||
|
||||
if ($query['cat_id']) $rows['no_cat_id'] = true;
|
||||
@ -447,7 +437,9 @@ class infolog_ui
|
||||
}
|
||||
// disable filemanager icon, if user has no access to it
|
||||
$readonlys['filemanager/navbar'] = !isset($GLOBALS['egw_info']['user']['apps']['filemanager']);
|
||||
$query['col_filter']['pm_id'] = $project; //add project back to the colfilter
|
||||
|
||||
if (isset($linked)) $query['col_filter']['linked'] = $linked; // add linked back to the colfilter
|
||||
|
||||
return $query['total'];
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@
|
||||
</hbox>
|
||||
</template>
|
||||
<template id="infolog.index.rows-noheader" template="" lang="" group="0" version="1.7.003">
|
||||
<grid width="100%" class="my_form">
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="2%"/>
|
||||
<column/>
|
||||
@ -152,7 +152,7 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="infolog.index.rows" template="" lang="" group="0" version="1.7.003">
|
||||
<template id="infolog.index.rows" template="" lang="" group="0" version="1.7.004">
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="2%"/>
|
||||
@ -181,7 +181,7 @@
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description/>
|
||||
<nextmatch-customfilter options="link-entry" id="linked" onchange="1"/>
|
||||
<nextmatch-sortheader label="Priority" align="right" id="info_priority" options="DESC" class="noPrint"/>
|
||||
</row>
|
||||
<row>
|
||||
|
Loading…
Reference in New Issue
Block a user