Skip to content

Commit

Permalink
Fix up broken add/modify operation in Kolab driver
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Schneider <jan@horde.org>
Bug: 13269
  • Loading branch information
thomasjfox authored and yunosh committed Jun 30, 2014
1 parent ed05c75 commit 7dfcba3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions mnemo/lib/Driver/Kolab.php
Expand Up @@ -132,13 +132,15 @@ public function getByUID($uid, $passphrase = null)
*/
protected function _add($noteId, $desc, $body, $tags)
{
$object = $this->_buildObject($noteId, $desc, $body, $tags);

try {
$this->_getData()
->create($this->_buildObject($noteId, $desc, $body, $tags));
$this->_getData()->create($object);
} catch (Horde_Kolab_Storage_Exception $e) {
throw new Mnemo_Exception($e);
}
return $uid;

return $object['uid'];
}

/**
Expand All @@ -154,13 +156,16 @@ protected function _add($noteId, $desc, $body, $tags)
*/
protected function _modify($noteId, $desc, $body, $tags)
{

$object = $this->_buildObject($noteId, $desc, $body, $tags);

try {
$this->_getData()
->modify($this->_buildObject($noteId, $desc, $body, $tags));
$this->_getData()->modify($object);
} catch (Horde_Kolab_Storage_Exception $e) {
throw new Mnemo_Exception($e);
}
return $uid;

return $object['uid'];
}

/**
Expand All @@ -171,7 +176,7 @@ protected function _modify($noteId, $desc, $body, $tags)
* @param string $body The whole note body.
* @param string $tags The tags of the note.
*
* @return string The Kolab hash.
* @return object The Kolab hash.
*/
protected function _buildObject($noteId, $desc, $body, $tags)
{
Expand All @@ -185,6 +190,8 @@ protected function _buildObject($noteId, $desc, $body, $tags)
->getInstance('Mnemo_Tagger')
->split($tags);
usort($object['categories'], 'strcoll');

return $object;
}

/**
Expand Down

0 comments on commit 7dfcba3

Please sign in to comment.