From ac7d79309e29684214af142e6f4d082db7ef4a6b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 9 Aug 2012 08:29:28 +0000 Subject: [PATCH] quieten warning in delete-category hook, if cat is not used --- addressbook/inc/class.addressbook_bo.inc.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addressbook/inc/class.addressbook_bo.inc.php b/addressbook/inc/class.addressbook_bo.inc.php index d8cc7b5a58..b01fa53466 100755 --- a/addressbook/inc/class.addressbook_bo.inc.php +++ b/addressbook/inc/class.addressbook_bo.inc.php @@ -1588,14 +1588,15 @@ class addressbook_bo extends addressbook_so // 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) + if (($ids = $this->search(array('cat_id' => $cat_id), false))) { - $info['cat_id'] = implode(',',array_diff(explode(',',$info['cat_id']), $cat_ids)); - $this->save($info); + foreach($ids as &$info) + { + $info['cat_id'] = implode(',',array_diff(explode(',',$info['cat_id']), $cat_ids)); + $this->save($info); + } } } }