Merge branch '2016.11' into 2016.11-develop
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 8 Feb 2017 15:29:45 +0000 (16:29 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 8 Feb 2017 15:29:45 +0000 (16:29 +0100)
Change-Id: I1adbbec4955550e8f56780539e3e424c7b8d8680

1  2 
tine20/Addressbook/Controller/Contact.php
tine20/Addressbook/Frontend/Cli.php
tine20/Tinebase/Controller/Record/Abstract.php

@@@ -607,10 -357,51 +595,54 @@@ class Addressbook_Controller_Contact ex
                  }
              }
          }
 +
 +        // syncBackendIds is read only property!
 +        unset($_record->syncBackendIds);
      }
+     /**
+      * do update of geo data only if one of address field changed
+      *
+      * @param $record
+      * @param $oldRecord
+      * @return bool
+      */
+     protected function _doUpdateGeoData($record, $oldRecord)
+     {
+         if (! $this->_setGeoDataForContacts) {
+             return false;
+         }
+         $addressDataChanged = false;
+         $addrOneEmpty = true;
+         $addrTwoEmpty = true;
+         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 ($addrOneEmpty && ! empty($record->{'adr_one_' . $field})) {
+                 $addrOneEmpty = false;
+             }
+             if ($addrTwoEmpty && ! empty($record->{'adr_two_' . $field})) {
+                 $addrTwoEmpty = false;
+             }
+         }
+         if ($addressDataChanged) {
+             return true;
+         }
+         if (! $addrOneEmpty && empty($record->adr_one_lat)) {
+             return true;
+         }
+         if (! $addrTwoEmpty && empty($record->adr_one_lat)) {
+             return true;
+         }
+         return false;
+     }
      
      /**
       * set geodata for given address of record
Simple merge