From e7b55ff59319d3c47933682e0bfad39884e28dd8 Mon Sep 17 00:00:00 2001 From: Lars Kneschke Date: Thu, 31 Aug 2006 03:08:23 +0000 Subject: [PATCH] handle birthdays from NOKIA clients --- calendar/inc/class.boical.inc.php | 37 +++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.boical.inc.php b/calendar/inc/class.boical.inc.php index 6969d28f8e..71f368cac1 100644 --- a/calendar/inc/class.boical.inc.php +++ b/calendar/inc/class.boical.inc.php @@ -314,6 +314,16 @@ } } } + + if(strtolower($this->productManufacturer) == 'nokia') { + if($event['special'] == '1') { + $attributes['X-EPOCAGENDAENTRYTYPE'] = 'ANNIVERSARY'; + $attributes['DTEND'] = $attributes['DTSTART']; + } else { + $attributes['X-EPOCAGENDAENTRYTYPE'] = 'APPOINTMENT'; + } + } + $modified = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'modify'); $created = $GLOBALS['egw']->contenthistory->getTSforAction($eventGUID,'add'); if (!$created && !$modified) $created = $event['modified']; @@ -646,6 +656,18 @@ break; } } + + // check if the entry is a birthday + // this field is only set from NOKIA clients + $agendaEntryType = $component->getAttribute('X-EPOCAGENDAENTRYTYPE'); + if (!is_a($agendaEntryType, 'PEAR_Error')) { + if(strtolower($agendaEntryType) == 'anniversary') { + $event['special'] = '1'; + // make it a whole day event for eGW + $vcardData['end'] = $vcardData['start'] + 86399; + } + } + if(!empty($vcardData['recur_enddate'])) { // reset recure_enddate to 00:00:00 on the last day @@ -704,7 +726,7 @@ } #error_log('ALARMS'); - #error_log(print_r($event['participants'], true)); + #error_log(print_r($event, true)); if (!($Ok = $this->update($event, TRUE))) { break; // stop with the first error @@ -739,7 +761,7 @@ function setSupportedFields($_productManufacturer='file', $_productName='') { // save them vor later use - $this->productManufacturere = $_productManufacturer; + $this->productManufacturer = $_productManufacturer; $this->productName = $_productName; $defaultFields[0] = array('public' => 'public', 'description' => 'description', 'end' => 'end', @@ -1048,6 +1070,17 @@ break; } } + + // check if the entry is a birthday + // this field is only set from NOKIA clients + $agendaEntryType = $component->getAttribute('X-EPOCAGENDAENTRYTYPE'); + if (!is_a($agendaEntryType, 'PEAR_Error')) { + if(strtolower($agendaEntryType) == 'anniversary') { + $event['special'] = '1'; + $vcardData['end'] = $vcardData['start'] + 86399; + } + } + if(!empty($vcardData['recur_enddate'])) { // reset recure_enddate to 00:00:00 on the last day