/**
  * inspect update of one record
  *
  * @param   Tinebase_Record_Interface $_record the update record
  * @param   Tinebase_Record_Interface $_oldRecord the current persistent record
  * @throws Tinebase_Exception_AccessDenied
  * @todo remove system note for updated jpegphoto when images are modlogged (@see 0000284: modlog of contact images / move images to vfs)
  */
 protected function _inspectBeforeUpdate($_record, $_oldRecord)
 {
     /** @var Addressbook_Model_Contact $_record */
     /** @var Addressbook_Model_Contact $_oldRecord */
     // do update of geo data only if one of address field changed
     $addressDataChanged = FALSE;
     foreach ($this->_addressFields as $field) {
         if ($_record->{'adr_one_' . $field} != $_oldRecord->{'adr_one_' . $field} || $_record->{'adr_two_' . $field} != $_oldRecord->{'adr_two_' . $field}) {
             $addressDataChanged = TRUE;
             break;
         }
     }
     if ($addressDataChanged) {
         $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.');
         $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;
     }
     if (!empty($_record->account_id) || $_record->type == Addressbook_Model_Contact::CONTACTTYPE_USER) {
         // first check if something changed that requires special rights
         $changeAccount = false;
         foreach (Addressbook_Model_Contact::getManageAccountFields() as $field) {
             if ($_record->{$field} != $_oldRecord->{$field}) {
                 $changeAccount = true;
                 break;
             }
         }
         // if so, check rights
         if ($changeAccount) {
             if (!Tinebase_Core::getUser()->hasRight('Admin', Admin_Acl_Rights::MANAGE_ACCOUNTS)) {
                 throw new Tinebase_Exception_AccessDenied('No permission to change account properties.');
             }
         }
     }
 }