Importexport - support deleteaccount hook

This commit is contained in:
nathangray 2019-07-22 15:10:43 -06:00
parent f160c697e4
commit 196cd13771
2 changed files with 30 additions and 2 deletions

View File

@ -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'
);
}
}
} }

View File

@ -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(