mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
* Infolog - Exclude current entry from parent select/search results to avoid loop
This commit is contained in:
parent
908ee59d1a
commit
2fc4caec71
@ -755,7 +755,7 @@ class Link extends Link\Storage
|
||||
*
|
||||
* @param string $app app to search
|
||||
* @param string $pattern pattern to search
|
||||
* @param array& $options passed to callback: type, start, num_rows, filter; on return value for "total"
|
||||
* @param array& $options passed to callback: type, start, num_rows, filter, exclude; on return value for "total"
|
||||
* @return array with $id => $title pairs of matching entries of app
|
||||
*/
|
||||
static function query($app, $pattern, &$options = array())
|
||||
@ -778,6 +778,10 @@ class Link extends Link\Storage
|
||||
{
|
||||
$options['total'] = count($result);
|
||||
}
|
||||
if (isset($options['exclude']))
|
||||
{
|
||||
$result = array_diff_key($result, array_flip($options['exclude']));
|
||||
}
|
||||
if (is_array($result) && (isset($options['start']) || (isset($options['num_rows']) && count($result) > $options['num_rows'])))
|
||||
{
|
||||
$result = array_slice($result, $options['start'], (isset($options['num_rows']) ? $options['num_rows'] : count($result)), true);
|
||||
|
@ -648,6 +648,30 @@ app.classes.infolog = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Mess with the query for parent widget to exclude self
|
||||
*
|
||||
* @param {Object} request
|
||||
* @param {et2_link_entry} widget
|
||||
* @returns {boolean}
|
||||
*/
|
||||
parent_query: function(request, widget)
|
||||
{
|
||||
// No ID yet, no need to filter
|
||||
if(!widget.getRoot().getArrayMgr('content').getEntry('info_id'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(!request.options)
|
||||
{
|
||||
request.options = {};
|
||||
}
|
||||
// Exclude self from results - no app needed since it's just one app
|
||||
request.options.exclude = [widget.getRoot().getArrayMgr('content').getEntry('info_id')];
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* View a list of timesheets for the linked infolog entry
|
||||
*
|
||||
|
@ -113,7 +113,7 @@
|
||||
</row>
|
||||
<row >
|
||||
<description value="Parent" font_style="1"/>
|
||||
<link-entry id="info_id_parent" onchange="if(egw && widget) { if(widget._oldValue) window.opener.egw.dataStoreUID(egw.appName+"::"+widget._oldValue,false);window.opener.egw.dataStoreUID(egw.appName+"::"+widget.getValue(),false);}" options="infolog" class="et2_fullWidth"/>
|
||||
<link-entry id="info_id_parent" onchange="if(egw && widget) { if(widget._oldValue) window.opener.egw.dataStoreUID(egw.appName+"::"+widget._oldValue,false);window.opener.egw.dataStoreUID(egw.appName+"::"+widget.getValue(),false);}" options="infolog" class="et2_fullWidth" query="app.infolog.parent_query" />
|
||||
</row>
|
||||
<row class="row">
|
||||
<description value="Priority" for="info_priority"/>
|
||||
|
Loading…
Reference in New Issue
Block a user