mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
Importexport - support deleteaccount hook
This commit is contained in:
parent
f160c697e4
commit
196cd13771
@ -60,7 +60,7 @@ class importexport_definitions_bo {
|
|||||||
$sql .= ') OR owner = '.$GLOBALS['egw_info']['user']['account_id'];
|
$sql .= ') OR owner = '.$GLOBALS['egw_info']['user']['account_id'];
|
||||||
$query['col_filter'][] = $sql;
|
$query['col_filter'][] = $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle allowed filter
|
// Handle allowed filter
|
||||||
if($query['col_filter']['allowed_users'])
|
if($query['col_filter']['allowed_users'])
|
||||||
{
|
{
|
||||||
@ -77,7 +77,7 @@ class importexport_definitions_bo {
|
|||||||
$query['col_filter'][] = '('.implode(' OR ', $allowed) . ')';
|
$query['col_filter'][] = '('.implode(' OR ', $allowed) . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = $this->so_sql->get_rows($query, $rows, $readonlys);
|
$total = $this->so_sql->get_rows($query, $rows, $readonlys);
|
||||||
$ro_count = 0;
|
$ro_count = 0;
|
||||||
foreach($rows as &$row) {
|
foreach($rows as &$row) {
|
||||||
@ -328,5 +328,32 @@ class importexport_definitions_bo {
|
|||||||
|
|
||||||
return $export;
|
return $export;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* changes or deletes entries with a specified owner (for deleteaccount hook)
|
||||||
|
*
|
||||||
|
* @param array $args hook arguments
|
||||||
|
* @param int $args['account_id'] account to delete
|
||||||
|
* @param int $args['new_owner']=0 new owner
|
||||||
|
* @todo test deleting an owner with replace and without
|
||||||
|
*/
|
||||||
|
function change_delete_owner(array $args) // new_owner=0 means delete
|
||||||
|
{
|
||||||
|
if (!(int) $args['new_owner'])
|
||||||
|
{
|
||||||
|
$this->so_sql->delete(array('owner'=>$args['account_id']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$GLOBALS['egw']->db->update(
|
||||||
|
self::_defintion_table,
|
||||||
|
array('owner'=>$args['new_owner']),
|
||||||
|
array('owner'=>$args['account_id']),
|
||||||
|
__LINE__,__FILE__,'importexport'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ $setup_info['importexport']['hooks']['sidebox_all'] = 'importexport_admin_prefs_
|
|||||||
$setup_info['importexport']['hooks']['etemplate2_register_widgets'] = 'importexport_admin_prefs_sidebox_hooks::widgets';
|
$setup_info['importexport']['hooks']['etemplate2_register_widgets'] = 'importexport_admin_prefs_sidebox_hooks::widgets';
|
||||||
$setup_info['importexport']['hooks']['config'] = 'importexport_admin_prefs_sidebox_hooks::config';
|
$setup_info['importexport']['hooks']['config'] = 'importexport_admin_prefs_sidebox_hooks::config';
|
||||||
$setup_info['importexport']['hooks']['config_after_save'] = 'importexport_admin_prefs_sidebox_hooks::config_after_save';
|
$setup_info['importexport']['hooks']['config_after_save'] = 'importexport_admin_prefs_sidebox_hooks::config_after_save';
|
||||||
|
$setup_info['importexport']['hooks']['deleteaccount'] = 'importexport.importexport_definitions_bo.change_delete_owner';
|
||||||
|
|
||||||
/* Dependencies for this app to work */
|
/* Dependencies for this app to work */
|
||||||
$setup_info['importexport']['depends'][] = array(
|
$setup_info['importexport']['depends'][] = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user