missing deleteaccount hook for timesheets

This commit is contained in:
Ralf Becker 2013-01-24 09:27:48 +00:00
parent 1c886276a8
commit 525daf4a3e
2 changed files with 30 additions and 3 deletions

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package timesheet * @package timesheet
* @copyright (c) 2005-11 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2005-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$ * @version $Id$
*/ */
@ -695,6 +695,32 @@ class timesheet_bo extends so_sql_cf
return $ret; return $ret;
} }
/**
* delete / move all timesheets of a given user
*
* @param array $data
* @param int $data['account_id'] owner to change
* @param int $data['new_owner'] new owner or 0 for delete
*/
function deleteaccount($data)
{
$account_id = $data['account_id'];
$new_owner = $data['new_owner'];
if (!$new_owner)
{
egw_link::unlink(0, TIMESHEET_APP, '', $account_id);
parent::delete(array('ts_owner' => $account_id));
}
else
{
$this->db->update($this->table_name, array(
'ts_owner' => $new_owner,
), array(
'ts_owner' => $account_id,
), __LINE__, __FILE__);
}
}
/** /**
* set a status for timesheet entry identified by $keys * set a status for timesheet entry identified by $keys

View File

@ -6,7 +6,7 @@
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package timesheet * @package timesheet
* @subpackage setup * @subpackage setup
* @copyright (c) 2005-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2005-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$ * @version $Id$
*/ */
@ -32,7 +32,7 @@ $setup_info[TIMESHEET_APP]['description'] =
'Tracking times and other activities for the Projectmanager.'; 'Tracking times and other activities for the Projectmanager.';
$setup_info[TIMESHEET_APP]['note'] = $setup_info[TIMESHEET_APP]['note'] =
'The TimeSheet application is sponsored by:<ul> 'The TimeSheet application is sponsored by:<ul>
<li> <a href="http://www.stylite.de" target="_blank">Stylite GmbH</a></li> <li> <a href="http://www.stylite.de" target="_blank">Stylite AG</a></li>
<li> <a href="http://www.outdoor-training.de" target="_blank">Outdoor Unlimited Training GmbH</a></li> <li> <a href="http://www.outdoor-training.de" target="_blank">Outdoor Unlimited Training GmbH</a></li>
</ul>'; </ul>';
@ -43,6 +43,7 @@ $setup_info[TIMESHEET_APP]['hooks']['admin'] = 'timesheet_hooks::all_hooks';
$setup_info[TIMESHEET_APP]['hooks']['sidebox_menu'] = 'timesheet_hooks::all_hooks'; $setup_info[TIMESHEET_APP]['hooks']['sidebox_menu'] = 'timesheet_hooks::all_hooks';
$setup_info[TIMESHEET_APP]['hooks']['search_link'] = 'timesheet_hooks::search_link'; $setup_info[TIMESHEET_APP]['hooks']['search_link'] = 'timesheet_hooks::search_link';
$setup_info[TIMESHEET_APP]['hooks']['pm_cumulate'] = 'timesheet_hooks::cumulate'; $setup_info[TIMESHEET_APP]['hooks']['pm_cumulate'] = 'timesheet_hooks::cumulate';
$setup_info[TIMESHEET_APP]['hooks']['deleteaccount'] = 'timesheet.timesheet_bo.deleteaccount';
/* Dependencies for this app to work */ /* Dependencies for this app to work */
$setup_info[TIMESHEET_APP]['depends'][] = array( $setup_info[TIMESHEET_APP]['depends'][] = array(