applied category preserve on import also to SIF classes

This commit is contained in:
Christian Binder 2009-11-19 15:30:53 +00:00
parent 84b0a80b5a
commit e76d659cac
3 changed files with 14 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;