some hooks needed for new policy app

This commit is contained in:
Ralf Becker 2018-06-12 19:04:02 +02:00
parent d201dc9fd9
commit baa2807606
3 changed files with 43 additions and 17 deletions

View File

@ -748,6 +748,17 @@ class Storage
{ {
$rows[$n] = $this->db2data($row); $rows[$n] = $this->db2data($row);
} }
// allow other apps to hook into search
Api\Hooks::process(array(
'hook_location' => 'contacts_search',
'criteria' => $criteria,
'filter' => $filter,
'ignore_acl' => $ignore_acl,
'obj' => $this,
'rows' => &$rows,
'total' => &$this->total,
), array(), true); // true = no permission check
} }
return $rows; return $rows;
} }

View File

@ -7,8 +7,7 @@
* @subpackage etemplate * @subpackage etemplate
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker@outdoor-training.de> * @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2002-16 by RalfBecker@outdoor-training.de * @copyright 2002-18 by RalfBecker@outdoor-training.de
* @version $Id$
*/ */
namespace EGroupware\Api\Etemplate\Widget; namespace EGroupware\Api\Etemplate\Widget;
@ -608,6 +607,17 @@ class Nextmatch extends Etemplate\Widget
{ {
$total = false; // method not callable $total = false; // method not callable
} }
// allow to hook into get_rows of other apps
Api\Hooks::process(array(
'hook_location' => 'etemplate2_after_get_rows',
'get_rows' => $method,
'value' => &$value,
'rows' => &$rows,
'readonlys' => &$readonlys,
'total' => &$total,
), array(), true); // true = no permission check
// if we have a nextmatch widget, find the repeating row // if we have a nextmatch widget, find the repeating row
if ($widget && $widget->attrs['template']) if ($widget && $widget->attrs['template'])
{ {
@ -850,10 +860,13 @@ class Nextmatch extends Etemplate\Widget
// by putting them as children // by putting them as children
// sets the default attributes to every children dataset // sets the default attributes to every children dataset
if (is_array($action['children'])) { if (is_array($action['children']))
foreach ($action['children'] as $key => $children) { {
foreach ($action['children'] as $key => $children)
{
// checks if children is a valid array and if the "$default_attrs" variable exists // checks if children is a valid array and if the "$default_attrs" variable exists
if (is_array($action['children'][$key]) && $default_attrs) { if (is_array($children) && $default_attrs)
{
$action['children'][$key] += $default_attrs; $action['children'][$key] += $default_attrs;
} }
} }

View File

@ -195,14 +195,7 @@ class History
$filter[$column] = $value; $filter[$column] = $value;
} }
} }
if ($GLOBALS['egw']->db->Type == 'mysql' && $GLOBALS['egw']->db->ServerInfo['version'] >= 4.0)
{
$mysql_calc_rows = 'SQL_CALC_FOUND_ROWS ';
}
else
{
$total = $GLOBALS['egw']->db->select(self::TABLE,'COUNT(*)',$filter,__LINE__,__FILE__,false,'','phpgwapi',0)->fetchColumn();
}
// filter out private (or no longer defined) custom fields // filter out private (or no longer defined) custom fields
if ($filter['history_appname']) if ($filter['history_appname'])
{ {
@ -293,6 +286,15 @@ class History
} }
$total = $GLOBALS['egw']->db->union($_query,__LINE__,__FILE__)->NumRows(); $total = $GLOBALS['egw']->db->union($_query,__LINE__,__FILE__)->NumRows();
// allow to hook into get_rows of other apps
Api\Hooks::process(array(
'hook_location' => 'etemplate2_history_get_rows',
'get_rows' => __METHOD__,
'value' => &$query,
'rows' => &$rows,
'total' => &$total,
), array(), true); // true = no permission check
return $total; return $total;
} }
} }