diff --git a/tine20/Addressbook/Controller/Contact.php b/tine20/Addressbook/Controller/Contact.php index 3cd8be13f7..9348d6ee9e 100644 --- a/tine20/Addressbook/Controller/Contact.php +++ b/tine20/Addressbook/Controller/Contact.php @@ -1367,9 +1367,13 @@ public function inspectUpdateUser(Tinebase_Model_FullUser $_updatedUser, Tinebas } } - $diff = $contact->diff($oldContact, $syncPhoto ? array('n_fn') : array('jpegphoto', 'n_fn')); + $omitFields = ['n_fn', 'n_fileas']; + if (! $syncPhoto) { + $omitFields[] = 'jpegphoto'; + } + /** @var Tinebase_Model_Diff $diff */ + $diff = $contact->diff($oldContact, $omitFields); if (! $diff->isEmpty() || ($oldContact->jpegphoto === 0 && !empty($contact->jpegphoto))) { - $oldContext = $this->_requestContext; if (!is_array($this->_requestContext)) { $this->_requestContext = array(); @@ -1378,10 +1382,17 @@ public function inspectUpdateUser(Tinebase_Model_FullUser $_updatedUser, Tinebas $this->_requestContext[self::CONTEXT_NO_ACCOUNT_UPDATE] = true; } + if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { + Tinebase_Core::getLogger()->debug( + __METHOD__ . '::' . __LINE__ . " Diff " . print_r($diff->toArray(), true)); + } + $this->update($contact, false); - if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ - . " updated contact " . $contact->n_given); + if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) { + Tinebase_Core::getLogger()->info( + __METHOD__ . '::' . __LINE__ . " Updated contact " . $contact->n_fn); + } $this->_requestContext = $oldContext; } diff --git a/tine20/Tinebase/User.php b/tine20/Tinebase/User.php index 89f713bbc4..518693ba54 100644 --- a/tine20/Tinebase/User.php +++ b/tine20/Tinebase/User.php @@ -649,17 +649,19 @@ protected static function _syncDataAndUpdateUser($user, $options) $currentUser = self::_getLdapUserController()->getUserByProperty('accountId', $user, 'Tinebase_Model_FullUser', true); if (self::_checkAndUpdateCurrentUser($currentUser, $user, $options)) { - if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ - . ' Record needs an update'); + if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { + Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ + . ' Record needs an update'); + } Tinebase_Timemachine_ModificationLog::setRecordMetaData($currentUser, 'update'); $syncedUser = self::_getLdapUserController()->updateUserInSqlBackend($currentUser); } else { $syncedUser = $currentUser; } + if (! empty($user->container_id)) { $syncedUser->container_id = $user->container_id; } - // Addressbook is registered as plugin and will take care of the update self::_getLdapUserController()->updatePluginUser($syncedUser, $user); @@ -719,9 +721,13 @@ protected static function _checkAndUpdateCurrentUser(Tinebase_Model_FullUser $cu continue; } // SYNC NON-EMPTY OPTIONAL or REQUIRED fields - else if ($currentUser->{$field} !== $user->{$field}) { - if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ + else if ($currentUser->{$field} !== $user->{$field} + && (! empty($currentUser->{$field}) || ! empty($user->{$field}))) + { + if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { + Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Diff found in field ' . $field . ' current: ' . $currentUser->{$field} . ' new: ' . $user->{$field}); + } $currentUser->{$field} = $user->{$field}; $recordNeedsUpdate = true; }