From f81ecdd6ef91c96278b6957dae09a4079caa4674 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 23 May 2013 12:10:31 -0400
Subject: [PATCH] Resolving VUFIND-818 (problem adding tags).

---
 module/VuFind/src/VuFind/Controller/AbstractRecord.php | 5 ++++-
 module/VuFind/src/VuFind/Controller/AjaxController.php | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
index 35e07b053b1..d49702235b2 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
@@ -242,7 +242,10 @@ class AbstractRecord extends AbstractBase
 
         // Perform the save operation:
         $driver = $this->loadRecord();
-        $driver->saveToFavorites($this->getRequest()->getPost()->toArray(), $user);
+        $post = $this->getRequest()->getPost()->toArray();
+        $tagParser = $this->getServiceLocator()->get('VuFind\Tags');
+        $post['mytags'] = $tagParser->parse($post['mytags']);
+        $driver->saveToFavorites($post, $user);
 
         // Display a success status message:
         $this->flashMessenger()->setNamespace('info')
diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php
index 844f685072d..5c6a41c3c4f 100644
--- a/module/VuFind/src/VuFind/Controller/AjaxController.php
+++ b/module/VuFind/src/VuFind/Controller/AjaxController.php
@@ -843,7 +843,10 @@ class AjaxController extends AbstractBase
             $this->params()->fromPost('id'),
             $this->params()->fromPost('source', 'VuFind')
         );
-        $driver->saveToFavorites($this->getRequest()->getPost()->toArray(), $user);
+        $post = $this->getRequest()->getPost()->toArray();
+        $tagParser = $this->getServiceLocator()->get('VuFind\Tags');
+        $post['mytags'] = $tagParser->parse($post['mytags']);
+        $driver->saveToFavorites($post, $user);
         return $this->output('Done', self::STATUS_OK);
     }
 
-- 
GitLab