forked from extern/egroupware
fixed several small issues around CardDAV and history logging in addressbook (dont log not set custom fields as there are not stored and therefore not changed)
This commit is contained in:
parent
f8d2a88e41
commit
1f76e0c191
@ -1882,10 +1882,9 @@ class addressbook_bo extends addressbook_so
|
||||
*/
|
||||
function find_or_add_categories($catname_list, $contact_id=null)
|
||||
{
|
||||
if ($contact_id && $contact_id > 0)
|
||||
if ($contact_id && $contact_id > 0 && ($old_contact = $this->read($contact_id)))
|
||||
{
|
||||
// preserve categories without users read access
|
||||
$old_contact = $this->read($contact_id);
|
||||
$old_categories = explode(',',$old_contact['cat_id']);
|
||||
$old_cats_preserve = array();
|
||||
if (is_array($old_categories) && count($old_categories) > 0)
|
||||
@ -1932,6 +1931,7 @@ class addressbook_bo extends addressbook_so
|
||||
sort($cat_id_list, SORT_NUMERIC);
|
||||
}
|
||||
|
||||
//error_log(__METHOD__."(".array2string($catname_list).", $contact_id) returning ".array2string($cat_id_list));
|
||||
return $cat_id_list;
|
||||
}
|
||||
|
||||
|
@ -508,6 +508,8 @@ class addressbook_groupdav extends groupdav_handler
|
||||
$contact['owner'] = $oldContact['owner'];
|
||||
$contact['private'] = $oldContact['private'];
|
||||
$contact['carddav_name'] = $oldContact['carddav_name'];
|
||||
$contact['tid'] = $oldContact['tid'];
|
||||
$contact['creator'] = $oldContact['creator'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -699,12 +701,9 @@ class addressbook_groupdav extends groupdav_handler
|
||||
{
|
||||
$handler = new addressbook_vcal('addressbook','text/vcard');
|
||||
// Apple iOS or OS X addressbook
|
||||
if ($this->agent = 'cfnetwork' || $this->agent == 'dataaccess')
|
||||
if ($this->agent == 'cfnetwork' || $this->agent == 'dataaccess')
|
||||
{
|
||||
$supportedFields = $handler->supportedFields;
|
||||
// Apple Addressbook don't support CLASS
|
||||
unset($supportedFields['CLASS']);
|
||||
unset($supportedFields['CATEGORIES']);
|
||||
// use just CELL and IPHONE, CELL;WORK and CELL;HOME are NOT understood
|
||||
//'TEL;CELL;WORK' => array('tel_cell'),
|
||||
//'TEL;CELL;HOME' => array('tel_cell_private'),
|
||||
|
@ -79,6 +79,8 @@ class addressbook_tracking extends bo_tracking
|
||||
unset($this->field2history['modified']);
|
||||
unset($this->field2history['modifier']);
|
||||
unset($this->field2history['etag']);
|
||||
unset($this->field2history['creator']);
|
||||
unset($this->field2history['tz']);
|
||||
|
||||
// we currently can only track text
|
||||
unset($this->field2history['jpegphoto']);
|
||||
|
@ -204,7 +204,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
#Horde::logMessage("vCalAddressbook clientProperties:\n" . print_r($this->clientProperties, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
|
||||
$vCard = new Horde_iCalendar_vcard($this->version);
|
||||
$vCard->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Addressbook '.$GLOBALS['egw_info']['apps']['addressbook']['version'].'//'.
|
||||
$vCard->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Addressbook '.$GLOBALS['egw_info']['apps']['phpgwapi']['version'].'//'.
|
||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
||||
|
||||
$sysCharSet = translation::charset();
|
||||
@ -283,6 +283,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
{
|
||||
case 'modified':
|
||||
$value = gmdate("Y-m-d\TH:i:s\Z",egw_time::user2server($value));
|
||||
$hasdata++;
|
||||
break;
|
||||
|
||||
case 'private':
|
||||
@ -329,7 +330,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
break;
|
||||
|
||||
case 'cat_id':
|
||||
if (!empty($value) && ($values = $this->get_categories($value)))
|
||||
if (!empty($value) && ($values = /*str_replace(',','\\,',*/$this->get_categories($value)))//)
|
||||
{
|
||||
$values = (array) translation::convert($values, $sysCharSet, $_charset);
|
||||
$value = implode(',', $values); // just for the CHARSET recognition
|
||||
@ -468,7 +469,6 @@ class addressbook_vcal extends addressbook_bo
|
||||
}
|
||||
|
||||
$vCard->setAttribute($vcardField, $value, $options, true, $values);
|
||||
//$vCard->setParameter($vcardField, $options);
|
||||
}
|
||||
|
||||
$result = $vCard->exportvCalendar($_charset);
|
||||
@ -560,6 +560,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
'X-ASSISTANT' => array('assistent'),
|
||||
'X-ASSISTANT-TEL' => array('tel_assistent'),
|
||||
'UID' => array('uid'),
|
||||
'REV' => array('modified'),
|
||||
);
|
||||
|
||||
if ($this->log)
|
||||
@ -579,7 +580,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
}
|
||||
$vcardValues = $vCard->getAllAttributes();
|
||||
|
||||
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']))
|
||||
if (!empty($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']))
|
||||
{
|
||||
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];
|
||||
}
|
||||
@ -599,6 +600,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
$url = 1;
|
||||
$pref_tel = false;
|
||||
|
||||
$rowNames = array();
|
||||
foreach($vcardValues as $key => $vcardRow)
|
||||
{
|
||||
$rowName = strtoupper($vcardRow['name']);
|
||||
@ -676,7 +678,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
switch ($pname)
|
||||
{
|
||||
case 'PREF':
|
||||
if ($rowName == 'TEL' && !$pref_tel)
|
||||
if (substr($rowName,0,3) == 'TEL' && !$pref_tel)
|
||||
{
|
||||
$pref_tel = $key;
|
||||
}
|
||||
@ -1053,7 +1055,7 @@ class addressbook_vcal extends addressbook_bo
|
||||
require_once(EGW_SERVER_ROOT.'/phpgwapi/inc/horde/Horde/iCalendar/vcard.php');
|
||||
|
||||
$vCard = new Horde_iCalendar_vcard($version);
|
||||
$vCard->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Addressbook '.$GLOBALS['egw_info']['apps']['addressbook']['version'].'//'.
|
||||
$vCard->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Addressbook '.$GLOBALS['egw_info']['apps']['phpgwapi']['version'].'//'.
|
||||
strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang']));
|
||||
|
||||
$vCard->setAttribute('N',$list['list_name'],array(),true,array($list['list_name'],'','','',''));
|
||||
|
@ -400,6 +400,8 @@ abstract class bo_tracking
|
||||
{
|
||||
if (!$old[$name] && !$data[$name]) continue; // treat all sorts of empty equally
|
||||
|
||||
if ($name[0] == '#' && !isset($data[$name])) continue; // no set customfields are not stored, therefore not changed
|
||||
|
||||
if (is_array($status)) // 1:N relation
|
||||
{
|
||||
self::compact_1_N_relation($data[$name],$status);
|
||||
|
Loading…
Reference in New Issue
Block a user