From d5dfb4af1f5ce75211fb80835db9a37b9f5119d2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 31 Jan 2013 12:45:43 +0000 Subject: [PATCH] if contact is an account and account-relevant data got updated, handle it like account got updated --- addressbook/inc/class.addressbook_bo.inc.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_bo.inc.php b/addressbook/inc/class.addressbook_bo.inc.php index 30d159314c..80ca74b604 100755 --- a/addressbook/inc/class.addressbook_bo.inc.php +++ b/addressbook/inc/class.addressbook_bo.inc.php @@ -907,9 +907,17 @@ class addressbook_bo extends addressbook_so $contact['etag'] = $to_write['etag']; $GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $contact['id'],$isUpdate ? 'modify' : 'add', time()); - if ($contact['account_id']) // invalidate the cache of the accounts class + // if contact is an account and account-relevant data got updated, handle it like account got updated + if ($contact['account_id'] && + ($old['email'] != $contact['email'] || $old['n_family'] != $contact['n_family'] || $old['n_given'] != $contact['n_given'])) { + // invalidate the cache of the accounts class $GLOBALS['egw']->accounts->cache_invalidate($contact['account_id']); + // call edit-accout hook, to let other apps know about changed account (names or email) + $GLOBALS['hook_values'] = $GLOBALS['egw']->accounts->read($contact['account_id']); + $GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array( + 'location' => 'editaccount', + ),False,True); // called for every app now, not only enabled ones) } // notify interested apps about changes in the account-contact data if (!$to_write['owner'] && $to_write['account_id'])