mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Use addressbook_bo functions instead of SO so full updates happen.
This commit is contained in:
parent
18208414bc
commit
04a081fd58
@ -1510,7 +1510,30 @@ class addressbook_bo extends addressbook_so
|
||||
*/
|
||||
function delete_category($data)
|
||||
{
|
||||
parent::delete_category($data);
|
||||
// get all cats if you want to drop sub cats
|
||||
$drop_subs = ($data['drop_subs'] && !$data['modify_subs']);
|
||||
if($drop_subs)
|
||||
{
|
||||
$cats = new categories('', 'addressbook');
|
||||
$cat_ids = $cats->return_all_children($data['cat_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cat_ids = array($data['cat_id']);
|
||||
}
|
||||
|
||||
// Get addresses that use the category
|
||||
@set_time_limit( 0 );
|
||||
$ids = array();
|
||||
foreach($cat_ids as $cat_id)
|
||||
{
|
||||
$ids = $this->search(array('cat_id' => $cat_id), false);
|
||||
foreach($ids as &$info)
|
||||
{
|
||||
$info['cat_id'] = implode(',',array_diff(explode(',',$info['cat_id']), $cat_ids));
|
||||
$this->save($info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -773,37 +773,6 @@ class addressbook_so
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove deleted category from addresses
|
||||
*/
|
||||
function delete_category($data)
|
||||
{
|
||||
// get all cats if you want to drop sub cats
|
||||
$drop_subs = ($data['drop_subs'] && !$data['modify_subs']);
|
||||
if($drop_subs)
|
||||
{
|
||||
$cats = new categories('', 'addressbook');
|
||||
$cat_ids = $cats->return_all_children($data['cat_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cat_ids = array($data['cat_id']);
|
||||
}
|
||||
|
||||
// Get addresses that use the category
|
||||
@set_time_limit( 0 );
|
||||
$ids = array();
|
||||
foreach($cat_ids as $cat_id)
|
||||
{
|
||||
$ids = $this->search(array('cat_id' => $cat_id), array('contact_id', 'cat_id'));
|
||||
foreach($ids as &$info)
|
||||
{
|
||||
$info['cat_id'] = implode(',',array_diff(explode(',',$info['cat_id']), $cat_ids));
|
||||
$this->save($info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return the backend, to be used for the given $contact_id
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user