From e76d659cac1cf33533ca174af1f1debb0ed5cd8c Mon Sep 17 00:00:00 2001 From: Christian Binder Date: Thu, 19 Nov 2009 15:30:53 +0000 Subject: [PATCH] applied category preserve on import also to SIF classes --- addressbook/inc/class.addressbook_sif.inc.php | 8 ++++---- calendar/inc/class.calendar_sif.inc.php | 8 ++++---- infolog/inc/class.infolog_sif.inc.php | 11 ++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/addressbook/inc/class.addressbook_sif.inc.php b/addressbook/inc/class.addressbook_sif.inc.php index 158303342f..bce20eb5f4 100644 --- a/addressbook/inc/class.addressbook_sif.inc.php +++ b/addressbook/inc/class.addressbook_sif.inc.php @@ -113,7 +113,7 @@ class addressbook_sif extends addressbook_bo $this->sifData .= $_data; } - function siftoegw($sifData) { + function siftoegw($sifData, $_abID=null) { #$tmpfname = tempnam('/tmp/sync/contents','sifc_'); @@ -141,7 +141,7 @@ class addressbook_sif extends addressbook_bo case 'cat_id': if(!empty($value)) { - $finalContact[$key] = implode(",", $this->find_or_add_categories(explode(';', $value))); + $finalContact[$key] = implode(",", $this->find_or_add_categories(explode(';', $value), $_abID)); } else { @@ -173,7 +173,7 @@ class addressbook_sif extends addressbook_bo { $result = false; - if($contact = $this->siftoegw($_sifdata)) { + if($contact = $this->siftoegw($_sifdata, $contentID)) { if ($contentID) { $contact['contact_id'] = $contentID; } @@ -195,7 +195,7 @@ class addressbook_sif extends addressbook_bo #error_log('ABID: '.$_abID); #error_log(base64_decode($_sifdata)); - if(!$contact = $this->siftoegw($_sifdata)) { + if(!$contact = $this->siftoegw($_sifdata, $_abID)) { return false; } diff --git a/calendar/inc/class.calendar_sif.inc.php b/calendar/inc/class.calendar_sif.inc.php index c66d4d217f..a1b5bc93e4 100644 --- a/calendar/inc/class.calendar_sif.inc.php +++ b/calendar/inc/class.calendar_sif.inc.php @@ -103,7 +103,7 @@ class calendar_sif extends calendar_boupdate $this->sifData .= $_data; } - function siftoegw($sifData) + function siftoegw($sifData, $_calID=-1) { $vcal = new Horde_iCalendar; $finalEvent = array(); @@ -164,7 +164,7 @@ class calendar_sif extends calendar_boupdate case 'category': if (!empty($value)) { - $finalEvent[$key] = implode(',',$this->find_or_add_categories(explode(';', $value))); + $finalEvent[$key] = implode(',',$this->find_or_add_categories(explode(';', $value), $_calID)); } break; @@ -255,7 +255,7 @@ class calendar_sif extends calendar_boupdate { $result = false; - if ($event = $this->siftoegw($_sifdata)) + if ($event = $this->siftoegw($_sifdata, $contentID)) { if ($contentID) { $event['id'] = $contentID; @@ -282,7 +282,7 @@ class calendar_sif extends calendar_boupdate #error_log('ABID: '.$_abID); #error_log(base64_decode($_sifdata)); - if (!$event = $this->siftoegw($_sifdata)) + if (!$event = $this->siftoegw($_sifdata, $_calID)) { return false; } diff --git a/infolog/inc/class.infolog_sif.inc.php b/infolog/inc/class.infolog_sif.inc.php index c35e4e61ac..25a5d1d149 100644 --- a/infolog/inc/class.infolog_sif.inc.php +++ b/infolog/inc/class.infolog_sif.inc.php @@ -116,9 +116,10 @@ class infolog_sif extends infolog_bo * * @param string $sifData the SIF data * @param string $_sifType type (note/task) + * @param int $_id=-1 the infolog id * @return array infolog entry or false on error */ - function siftoegw($sifData, $_sifType) + function siftoegw($sifData, $_sifType, $_id=-1) { $sysCharSet = $GLOBALS['egw']->translation->charset(); @@ -203,7 +204,7 @@ class infolog_sif extends infolog_bo case 'info_cat': if (!empty($value)) { - $categories = $this->find_or_add_categories(explode(';', $value)); + $categories = $this->find_or_add_categories(explode(';', $value), $_id); $taskData['info_cat'] = $categories[0]; } break; @@ -307,7 +308,7 @@ class infolog_sif extends infolog_bo case 'info_cat': if (!empty($value)) { - $categories = $this->find_or_add_categories(explode(';', $value)); + $categories = $this->find_or_add_categories(explode(';', $value), $_id); $noteData['info_cat'] = $categories[0]; } break; @@ -338,7 +339,7 @@ class infolog_sif extends infolog_bo */ function searchSIF($_sifData, $_sifType, $contentID=null, $relax=false) { - if (!($egwData = $this->siftoegw($_sifData, $_sifType))) return false; + if (!($egwData = $this->siftoegw($_sifData, $_sifType, $contentID))) return false; if ($contentID) $egwData['info_id'] = $contentID; @@ -372,7 +373,7 @@ class infolog_sif extends infolog_bo */ function addSIF($_sifData, $_id, $_sifType, $merge=false) { - if (!($egwData = $this->siftoegw($_sifData, $_sifType))) return false; + if (!($egwData = $this->siftoegw($_sifData, $_sifType, $_id))) return false; if ($_id > 0) $egwData['info_id'] = $_id;