0013232: Change of contact image does not log useful information in timemachine
authorIngo Ratsdorf <ingo@envirology.co.nz>
Thu, 22 Jun 2017 09:21:48 +0000 (21:21 +1200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 3 Jul 2017 06:43:29 +0000 (08:43 +0200)
Added additional modlog message for deleted contact image, now supporting new and deleted image

https://forge.tine20.org/view.php?id=13232

Change-Id: I8e953067c52318850b68fd75696c625b42f14a5c
Reviewed-on: https://gerrit.tine20.org/tine20/3457
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Addressbook/Controller/Contact.php
tine20/Addressbook/translations/template.pot

index b6fec6b..1fb9b93 100644 (file)
@@ -583,16 +583,24 @@ class Addressbook_Controller_Contact extends Tinebase_Controller_Record_Abstract
             $this->_setGeoData($_record);
         }
         
-        if (isset($_record->jpegphoto) && ! empty($_record->jpegphoto)) {
-            // add system note when jpegphoto gets updated
-            $translate = $translate = Tinebase_Translation::getTranslation('Addressbook');
-            $noteMessage = $translate->_('Uploaded new contact image.');
+        if (isset($_record->jpegphoto)){
+            // add system note when jpegphoto gets changed
+            $translate = Tinebase_Translation::getTranslation('Addressbook');
+            $noteMessage = "";
+
+            if (! empty($_record->jpegphoto)) {
+                // new or updated contact image supplied
+                $noteMessage = $translate->_('Uploaded new contact image.');
+            } else {
+                // contact image deleted
+                $noteMessage = $translate->_('Deleted contact image.');
+            }
             $traceException = new Exception($noteMessage);
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
                 . ' ' . $traceException);
             Tinebase_Notes::getInstance()->addSystemNote($_record, Tinebase_Core::getUser(), Tinebase_Model_Note::SYSTEM_NOTE_NAME_CHANGED, $noteMessage);
         }
-        
+
         if (isset($_oldRecord->type) && $_oldRecord->type == Addressbook_Model_Contact::CONTACTTYPE_USER) {
             $_record->type = Addressbook_Model_Contact::CONTACTTYPE_USER;
         }
index feb99ed..b60cbfb 100644 (file)
@@ -717,10 +717,14 @@ msgstr ""
 msgid "Search for Contacts ..."
 msgstr ""
 
-#: Controller/Contact.php:348
+#: Controller/Contact.php:592
 msgid "Uploaded new contact image."
 msgstr ""
 
+#: Controller/Contact.php:601
+msgid "Deleted contact image."
+msgstr ""
+
 #: Preference.php:28
 msgid "All contacts"
 msgstr ""