From 04ba662494adc85cb8bd57c5d98af06d3bb4d877 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 14 Jun 2007 06:16:19 +0000 Subject: [PATCH] small enhancement to keep the attachments, 'til the infolog entry gets finally deleted --- infolog/inc/class.boinfolog.inc.php | 6 ++++-- phpgwapi/inc/class.bolink.inc.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index 34ae3b2f3f..3b636528b0 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -540,15 +540,17 @@ class boinfolog if ($info['info_status'] == 'deleted') return false; // entry already deleted $this->so->write($deleted); + + $this->link->unlink(0,'infolog',$info_id,'','!file'); // keep the file attachments, only delete the rest } else { $this->so->delete($info_id,false); // we delete the children via bo to get all notifications! + + $this->link->unlink(0,'infolog',$info_id); } if ($info['info_status'] != 'deleted') // dont notify of final purge of already deleted items { - $this->link->unlink(0,'infolog',$info_id); - $GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); // send email notifications and do the history logging diff --git a/phpgwapi/inc/class.bolink.inc.php b/phpgwapi/inc/class.bolink.inc.php index 4ed07051c0..1190dbf5b5 100644 --- a/phpgwapi/inc/class.bolink.inc.php +++ b/phpgwapi/inc/class.bolink.inc.php @@ -357,7 +357,7 @@ class bolink extends solink * @param $link_id link-id to remove if > 0 * @param string $app='' appname of first endpoint * @param string/array &$id='' id in $app or array with links, if 1. entry not yet created - * @param string $app2='' app of second endpoint + * @param string $app2='' app of second endpoint, or !file (other !app are not yet supported!) * @param string $id2='' id in $app2 * @return the number of links deleted */ @@ -381,12 +381,12 @@ class bolink extends solink } if (!is_array($id)) { - if (!$link_id && !$app2 && !$id2) + if (!$link_id && !$app2 && !$id2 && $app2 != '!'.$this->vfs_appname) { $this->delete_attached($app,$id); // deleting all attachments unset($this->title_cache[$app.':'.$id]); } - $deleted =& solink::unlink($link_id,$app,$id,$owner,$app2,$id2); + $deleted =& solink::unlink($link_id,$app,$id,$owner,$app2 != '!'.$this->vfs_appname ? $app2 : '',$id2); // only notify on real links, not the one cached for writing or fileattachments $this->notify_unlink($deleted);