From fcda447798c52660904f12d126653af51c4bff8a Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 31 Dec 2012 21:57:14 +0000 Subject: [PATCH] Delete & hold accessories when deleting a resource --- resources/inc/class.resources_bo.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/inc/class.resources_bo.inc.php b/resources/inc/class.resources_bo.inc.php index 90a9a3c004..e5311da508 100755 --- a/resources/inc/class.resources_bo.inc.php +++ b/resources/inc/class.resources_bo.inc.php @@ -395,7 +395,7 @@ class resources_bo return lang('You are not permitted to delete this resource!'); } - // check if we only mark timesheets as deleted, or really delete them + // check if we only mark resources as deleted, or really delete them $old = $this->read($res_id); $config = config::read('resources'); if ($config['history'] != '' && $old['deleted'] == null) @@ -403,6 +403,11 @@ class resources_bo $old['deleted'] = time(); $this->save($old); egw_link::unlink(0,'resources',$res_id,'','','',true); + $accessories = $this->get_acc_list($res_id); + foreach($accessories as $acc_id => $name) + { + $this->delete($acc_id); + } return false; } elseif ($this->so->delete(array('res_id'=>$res_id)))