From ff3cd8725d3e278ac17c1c43db83a75f8ba4d669 Mon Sep 17 00:00:00 2001 From: Philippe Logel Date: Sat, 14 Apr 2018 17:46:17 +0200 Subject: [PATCH] The update --- src/EcclesiaCRM/model/EcclesiaCRM/User.php | 10 ++++++++++ src/EcclesiaCRM/sabre/EcclesiaCRMServer.php | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/EcclesiaCRM/model/EcclesiaCRM/User.php b/src/EcclesiaCRM/model/EcclesiaCRM/User.php index 426ec09381..aa1e0df0fb 100644 --- a/src/EcclesiaCRM/model/EcclesiaCRM/User.php +++ b/src/EcclesiaCRM/model/EcclesiaCRM/User.php @@ -10,6 +10,7 @@ use EcclesiaCRM\ListOptionQuery; use EcclesiaCRM\dto\SystemURLs; use EcclesiaCRM\Utils\MiscUtils; +use EcclesiaCRM\NoteQuery; /** * Skeleton subclass for representing a row from the 'user_usr' table. @@ -290,4 +291,13 @@ public function createTimeLineNote($type,$info = null) $note->save(); } + + public function deleteTimeLineNote($type,$info = null) + { + $notes = NoteQuery::Create ()->filterByPerId ($this->getPersonId())->findByText (str_replace("home/","",$info)); + + if (!empty($notes)) { + $notes->delete(); + } + } } diff --git a/src/EcclesiaCRM/sabre/EcclesiaCRMServer.php b/src/EcclesiaCRM/sabre/EcclesiaCRMServer.php index 594a8b8a88..77ebacc45e 100644 --- a/src/EcclesiaCRM/sabre/EcclesiaCRMServer.php +++ b/src/EcclesiaCRM/sabre/EcclesiaCRMServer.php @@ -83,17 +83,17 @@ function getCopyAndMoveInfo(RequestInterface $request) { function updateProperties($path, array $properties) { $res = parent::updateProperties($path, $properties); - return $res; + return $res; } function beforeUnbind($uri) { if (strpos($uri,"._") == false && strpos($uri,".DS_Store") == false) { $currentUser = UserQuery::create()->findOneByUserName($this->authBackend->getLoginName()); - $currentUser->createTimeLineNote("dav-delete-file",$uri); + $currentUser->deleteTimeLineNote("dav-delete-file",$uri); } - return true; - } + return true; + } }