From 6bb1bfae0a56c595bb048692000d69586bb844cd Mon Sep 17 00:00:00 2001 From: skeeter Date: Sat, 12 Jan 2002 01:33:40 +0000 Subject: [PATCH] Added change_owner to the xml-rpc/soap calls and changed the call to change_owner in deletaccount hook to use execmethod. --- calendar/inc/class.bocalendar.inc.php | 21 +++++++++++++++++++-- calendar/inc/hook_deleteaccount.inc.php | 11 +++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index fab7933816..354041da59 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -20,6 +20,7 @@ 'read_entry' => True, 'delete_entry' => True, 'delete_calendar' => True, + 'change_owner' => True, 'update' => True, 'preferences' => True, 'store_to_cache' => True, @@ -52,6 +53,14 @@ 'int' ) ), + 'change_owner' => Array( + 'in' => Array( + 'array' + ), + 'out' => Array( + 'int' + ) + ), 'update' => Array( 'in' => Array( 'array', @@ -305,6 +314,11 @@ 'signature' => array(array(xmlrpcInt,xmlrpcInt)), 'docstring' => lang('Delete an entire users calendar.') ), + 'change_owner' => array( + 'function' => 'change_owner', + 'signature' => array(array(xmlrpcInt,xmlrpcStruct)), + 'docstring' => lang('Change all events for $params[\'old_owner\'] to $params[\'new_owner\'].') + ), 'store_to_cache' => array( 'function' => 'store_to_cache', 'signature' => array(array(xmlrpcStruct,xmlrpcStruct)), @@ -493,11 +507,14 @@ } } - function change_owner($account_id,$new_owner) + function change_owner($params='') { if($GLOBALS['phpgw_info']['server']['calendar_type'] == 'sql') { - $this->so->change_owner($account_id,$new_owner); + if(is_array($params)) + { + $this->so->change_owner($params['old_owner'],$params['new_owner']); + } } } diff --git a/calendar/inc/hook_deleteaccount.inc.php b/calendar/inc/hook_deleteaccount.inc.php index 41c13455d9..6943770922 100755 --- a/calendar/inc/hook_deleteaccount.inc.php +++ b/calendar/inc/hook_deleteaccount.inc.php @@ -12,14 +12,17 @@ /* $Id$ */ // Delete all records for a user - $cal = CreateObject('calendar.bocalendar'); - if(intval($GLOBALS['HTTP_POST_VARS']['new_owner'])==0) { - $cal->delete_calendar(intval($GLOBALS['HTTP_POST_VARS']['account_id'])); + ExecMethod('calendar.bocalendar.delete_calendar',intval($GLOBALS['HTTP_POST_VARS']['account_id'])); } else { - $cal->change_owner(intval($GLOBALS['HTTP_POST_VARS']['account_id']),intval($GLOBALS['HTTP_POST_VARS']['new_owner'])); + ExecMethod('calendar.bocalendar.change_owner', + Array( + 'old_owner' => intval($GLOBALS['HTTP_POST_VARS']['account_id']), + 'new_owner' => intval($GLOBALS['HTTP_POST_VARS']['new_owner']) + ) + ); } ?>