Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 15 Sep 2016 08:08:45 +0000 (10:08 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 15 Sep 2016 08:08:45 +0000 (10:08 +0200)
1  2 
tine20/Addressbook/Model/Contact.php
tine20/Tinebase/User.php

Simple merge
@@@ -569,15 -552,26 +569,28 @@@ class Tinebase_Use
                  . ' new contact: ' . print_r($contact->toArray(), true)
                  . ' orig contact:' . print_r($originalContact->toArray(), true));
  
-             $syncPhoto = isset($options['syncContactPhoto']) && $options['syncContactPhoto'];
-             $diff = $contact->diff($originalContact, $syncPhoto ? array() : array('jpegphoto'));
-             if (! $diff->isEmpty() || ($originalContact->jpegphoto == 0 && ! empty($contact->jpegphoto))) {
+             if (isset($options['syncContactPhoto']) && $options['syncContactPhoto']) {
+                 $syncPhoto = true;
+                 if ($originalContact->jpegphoto == 1) {
+                     // TODO use generic function with ignoreAcl ...
+                     //$originalContact->jpegphoto = Tinebase_Controller::getInstance()->getImage('Addressbook', $originalContact->getId())->getBlob();
+                     $adb = new Addressbook_Backend_Sql();
+                     $originalContact->jpegphoto = $adb->getImage($originalContact->getId());
+                 }
+                 if ($contact->jpegphoto == 1) {
+                     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
+                         . ' Removing/unset current jpegphoto');
+                     $contact->jpegphoto = false;
+                 }
+             }
+             $diff = $contact->diff($originalContact, $syncPhoto ? array('n_fn') : array('jpegphoto', 'n_fn'));
+             if (! $diff->isEmpty() || ($originalContact->jpegphoto === 0 && ! empty($contact->jpegphoto)) ) {
                  // add modlog info
                  Tinebase_Timemachine_ModificationLog::setRecordMetaData($contact, 'update');
 -                Tinebase_Container::getInstance()->increaseContentSequence($contact->container_id);
 -
 +                if ($contact->container_id !== null) {
 +                    Tinebase_Container::getInstance()->increaseContentSequence($contact->container_id);
 +                }
 +                
                  if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
                      . ' Updating contact data for user ' . $syncedUser->accountLoginName);
                  if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__