From: Jan Schneider Date: Thu, 1 Oct 2009 12:00:55 +0000 (+0200) Subject: Update deleted attributes during synchronization (lst_hoe02@kwsoft.de, Request #6658). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=28297a3bb71e39fcf68d6751f287e4e7c8896923;p=horde.git Update deleted attributes during synchronization (lst_hoe02@kwsoft.de, Request #6658). --- diff --git a/turba/docs/CHANGES b/turba/docs/CHANGES index 309b11c76..dd61ca773 100644 --- a/turba/docs/CHANGES +++ b/turba/docs/CHANGES @@ -10,6 +10,8 @@ v3.0-git v2.3.3-cvs ---------- +[jan] Update deleted attributes during synchronization (lst_hoe02@kwsoft.de, + Request #6658). [jan] Support X-ANNIVERSARY, X-CHILDREN, and X-SPOUSE vCard fields (Request #8074). [jan] Fix copying and moving of image fields (Ryu , Bug #8523). diff --git a/turba/lib/Driver.php b/turba/lib/Driver.php index 028384f18..44f37e6f2 100644 --- a/turba/lib/Driver.php +++ b/turba/lib/Driver.php @@ -951,9 +951,6 @@ class Turba_Driver $geo = null; foreach ($hash as $key => $val) { - if (!strlen($val)) { - continue; - } if ($version != '2.1') { $val = Horde_String::convertCharset($val, Horde_Nls::getCharset(), 'utf-8'); } @@ -1165,9 +1162,7 @@ class Turba_Driver case 'businessCategory': case 'category': - if (!empty($val)) { - $vcard->setAttribute('CATEGORIES', $val); - } + $vcard->setAttribute('CATEGORIES', $val); break; case 'anniversary': @@ -1297,10 +1292,10 @@ class Turba_Driver } $org = array(); - if (isset($hash['company'])) { + if (array_key_exists('company', $hash)) { $org[] = $hash['company']; } - if (isset($hash['department'])) { + if (array_key_exists('department', $hash)) { $org[] = $hash['department']; } if (count($org)) { @@ -1312,11 +1307,14 @@ class Turba_Driver $vcard->setAttribute('ORG', $val, Horde_Mime::is8bit($val) ? $charset : array(), false, $org); } - if (isset($hash['commonAddress']) || isset($hash['commonStreet']) || - isset($hash['commonPOBox']) || isset($hash['commonExtended']) || - isset($hash['commonStreet']) || isset($hash['commonCity']) || - isset($hash['commonProvince']) || - isset($hash['commonPostalCode']) || isset($hash['commonCountry'])) { + if (array_key_exists('commonAddress', $hash) || + array_key_exists('commonStreet', $hash) || + array_key_exists('commonPOBox', $hash) || + array_key_exists('commonExtended', $hash) || + array_key_exists('commonCity', $hash) || + array_key_exists('commonProvince', $hash) || + array_key_exists('commonPostalCode', $hash) || + array_key_exists('commonCountry', $hash)) { /* We can't know if this particular Turba source uses a single * address field or multiple for * street/city/province/postcode/country. Try to deal with @@ -1356,11 +1354,14 @@ class Turba_Driver $vcard->setAttribute('ADR', $val, $params, true, $a); } - if (isset($hash['homeAddress']) || isset($hash['homeStreet']) || - isset($hash['homePOBox']) || isset($hash['homeExtended']) || - isset($hash['homeStreet']) || isset($hash['homeCity']) || - isset($hash['homeProvince']) || isset($hash['homePostalCode']) || - isset($hash['homeCountry'])) { + if (array_key_exists('homeAddress', $hash) || + array_key_exists('homeStreet', $hash) || + array_key_exists('homePOBox', $hash) || + array_key_exists('homeExtended', $hash) || + array_key_exists('homeCity', $hash) || + array_key_exists('homeProvince', $hash) || + array_key_exists('homePostalCode', $hash) || + array_key_exists('homeCountry', $hash)) { if (isset($hash['homeAddress']) && !isset($hash['homeStreet'])) { $hash['homeStreet'] = $hash['homeAddress']; } @@ -1395,11 +1396,14 @@ class Turba_Driver $vcard->setAttribute('ADR', $val, $params, true, $a); } - if (isset($hash['workAddress']) || isset($hash['workStreet']) || - isset($hash['workPOBox']) || isset($hash['workExtended']) || - isset($hash['workStreet']) || isset($hash['workCity']) || - isset($hash['workProvince']) || isset($hash['workPostalCode']) || - isset($hash['workCountry'])) { + if (array_key_exists('workAddress', $hash) || + array_key_exists('workStreet', $hash) || + array_key_exists('workPOBox', $hash) || + array_key_exists('workExtended', $hash) || + array_key_exists('workCity', $hash) || + array_key_exists('workProvince', $hash) || + array_key_exists('workPostalCode', $hash) || + array_key_exists('workCountry', $hash)) { if (isset($hash['workAddress']) && !isset($hash['workStreet'])) { $hash['workStreet'] = $hash['workAddress']; } @@ -1475,10 +1479,6 @@ class Turba_Driver $hash = array(); $attr = $vcard->getAllAttributes(); foreach ($attr as $item) { - if (empty($item['value'])) { - continue; - } - switch ($item['name']) { case 'FN': $hash['name'] = $item['value'];