From 049e6be8fe06b77b14cd8e5da620fa4de69c1b67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@ub.uni-leipzig.de>
Date: Fri, 9 Sep 2016 13:44:51 +0200
Subject: [PATCH] refs #8641: * reorganized email controllers and templates in
 finc module

---
 local/config/vufind/EmailProfiles.ini         |   8 +-
 local/config/vufind/config.ini                |   9 -
 local/config/vufind/permissions.ini           |   6 +
 .../CustomTraits/AcquisitionTrait.php         | 244 ++++++++++++++++
 .../{ => CustomTraits}/EblTrait.php           |   2 +-
 .../{ => CustomTraits}/EmailHoldTrait.php     |   5 +-
 .../CustomTraits/EmailProfileTrait.php        |  66 +++++
 .../{ => CustomTraits}/PdaTrait.php           |  57 ++--
 .../CustomTraits/ReportErrorsTrait.php        | 210 ++++++++++++++
 .../CustomTraits/ResetPasswordTrait.php       | 201 ++++++++++++++
 .../DocumentDeliveryServiceController.php     |  26 +-
 .../finc/Controller/MyResearchController.php  | 261 +-----------------
 .../src/finc/Controller/RecordController.php  |  30 +-
 module/finc/src/finc/Mailer/Mailer.php        |  17 +-
 .../Auth/AbstractBase/resetpassword.phtml     |   8 +-
 .../templates/Email/acquisition-html.phtml    |  24 +-
 .../templates/Email/acquisition-text.phtml    |  14 +-
 .../templates/Email/acquisitionpda-html.phtml |   8 +-
 themes/finc/templates/Email/dds-html.phtml    | 146 ++++++++++
 .../templates/Email/journalhold-html.phtml    |   4 +-
 .../templates/Email/reporterrors-html.phtml   |  55 ++++
 .../templates/Email/reporterrors-plain.phtml  |  38 +++
 .../templates/Email/resetpassword-html.phtml  |   4 +-
 .../templates/myresearch/acquisition.phtml    |  23 +-
 24 files changed, 1080 insertions(+), 386 deletions(-)
 create mode 100644 module/finc/src/finc/Controller/CustomTraits/AcquisitionTrait.php
 rename module/finc/src/finc/Controller/{ => CustomTraits}/EblTrait.php (98%)
 rename module/finc/src/finc/Controller/{ => CustomTraits}/EmailHoldTrait.php (98%)
 create mode 100644 module/finc/src/finc/Controller/CustomTraits/EmailProfileTrait.php
 rename module/finc/src/finc/Controller/{ => CustomTraits}/PdaTrait.php (85%)
 create mode 100644 module/finc/src/finc/Controller/CustomTraits/ReportErrorsTrait.php
 create mode 100644 module/finc/src/finc/Controller/CustomTraits/ResetPasswordTrait.php
 create mode 100644 themes/finc/templates/Email/dds-html.phtml
 create mode 100644 themes/finc/templates/Email/reporterrors-html.phtml
 create mode 100644 themes/finc/templates/Email/reporterrors-plain.phtml

diff --git a/local/config/vufind/EmailProfiles.ini b/local/config/vufind/EmailProfiles.ini
index 048eb43f806..68bec50de21 100644
--- a/local/config/vufind/EmailProfiles.ini
+++ b/local/config/vufind/EmailProfiles.ini
@@ -2,10 +2,12 @@
 
 ;[Acquisition]
 ;to = team@finc.info
-;from_unknown = team@finc.info
-;subject_acquisition = "Ihr Auftrag: %s, %s"
+;to_name = "Finc Team"
+;from = team@finc.info
+;from_name = "Finc Team"
+;subject = "Ihr Auftrag: %s, %s"
 
-;[ReportError]
+;[ReportErrors]
 ;to = team@finc.info
 ;to_name = "Finc Team"
 ;from = team@finc.info
diff --git a/local/config/vufind/config.ini b/local/config/vufind/config.ini
index 0d862505eb3..d3d88eb97e5 100644
--- a/local/config/vufind/config.ini
+++ b/local/config/vufind/config.ini
@@ -1517,15 +1517,6 @@ remove[] = "gndcontent"
 remove[] = "gndcarrier"
 remove[] = "gndmusic"
 
-; This section configures the form for acquisition suggestions.
-;[Acquisition]
-; Email address to receive the acquisition suggestions
-;to = erwerbungsservice@ub.uni-leipzig.de
-; Email address to be placed as sender if the patrons email address is unknown
-;from_unknown = katalog@ub.uni-leipzig.de
-; Email subject
-;subject_acquisition = "Ihr Auftrag: %s, %s"
-
 ; Section to configure Ebook Central service - EBL Choice service provided by
 ; ProQuest http://www.proquest.com
 ; Please note: Service if only available with configuration of [LinksRewrite]
diff --git a/local/config/vufind/permissions.ini b/local/config/vufind/permissions.ini
index d4089b21ef3..994c2b86245 100644
--- a/local/config/vufind/permissions.ini
+++ b/local/config/vufind/permissions.ini
@@ -79,6 +79,12 @@
 ;catUserType = UBL:pdaAccessGranted
 ;permission = access.PDAForm
 
+; Configuration for permitting Acquisition form action
+;[default.Acquisition]
+;role = loggedin
+;catUserType = DE-15:pdaAccessGranted
+;permission = access.AcquisitionForm
+
 ; Configuration for permitting DDS form action
 ;[default.DDS]
 ;role = loggedin
diff --git a/module/finc/src/finc/Controller/CustomTraits/AcquisitionTrait.php b/module/finc/src/finc/Controller/CustomTraits/AcquisitionTrait.php
new file mode 100644
index 00000000000..ff0ca60cb79
--- /dev/null
+++ b/module/finc/src/finc/Controller/CustomTraits/AcquisitionTrait.php
@@ -0,0 +1,244 @@
+<?php
+/**
+ * Acquisition Trait
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2010.
+ * Copyright (C) Leipzig University Library 2015.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @author   Frank Morgner <morgnerf@ub.uni-leipzig.de>
+ * @author   André Lahmann <lahmann@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+namespace finc\Controller\CustomTraits;
+use VuFind\Exception\Mail as MailException,
+    finc\Mailer\Mailer,
+    Zend\Mail\Address,
+    Zend\Validator\StringLength,
+    Zend\Validator\Identical;
+
+/**
+ * Acquisition Trait
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @author   Frank Morgner <morgnerf@ub.uni-leipzig.de>
+ * @author   André Lahmann <lahmann@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+trait AcquisitionTrait
+{
+    /**
+     * Profile to be used for email
+     */
+    //const ACQUISITION_EMAIL_PROFILE = 'Acquisition';
+
+    /**
+     * Acquisition action - controller method
+     *
+     * @todo Open issue: Implementation of accession/domain check of user by PAIA.
+     *
+     * @return \Zend\View\Model\ViewModel
+     */
+    public function acquisitionAction()
+    {
+        // Check with the set accessPermission if the user is authorized to use PDA
+        $accessPermission = 'access.AcquisitionForm';
+
+        if (!($user = $this->getUser())) {
+            return $this->forceLogin();
+        }
+
+        $auth = $this->getAuthorizationService();
+        if (!$auth) {
+            throw new \Exception('Authorization service missing');
+        }
+
+        if (!$auth->isGranted($accessPermission)) {
+            $this->flashMessenger()->addMessage('PDA::pda_restriction_text', 'error');
+            $view = $this->createViewModel();
+            return $this->forwardTo('myresearch', 'home');
+        }
+
+        // User is authorized to use Acquisition
+
+        // Do we have valid catalog credentials - if we do, use the catalog user data
+        // for the form instead
+        if (is_array($patron = $this->catalogLogin())) {
+            $catalog = $this->getILS();
+            $profile = $catalog->getMyProfile($patron);
+        }
+
+        // Start collecting params for Acquisition email
+
+        // prefer profile data from ILS over user data from db
+        $params = [
+            'username'  => trim($user->cat_username),
+            'email'     => isset($profile['email'])
+                ? trim($profile['email']) : trim($user->email),
+            'firstname' => isset($profile['firstname'])
+                ? trim($profile['firstname']) : trim($user->firstname),
+            'lastname'  => isset($profile['lastname'])
+                ? trim($profile['lastname']) : trim($user->lastname),
+            'group' => isset($profile['group'])
+                ? trim($profile['group']) : ''
+        ];
+
+        // Create view
+        $view = $this->createAcquisitionViewModel();
+
+        // Set up reCaptcha
+        //todo: testen!
+        $view->useRecaptcha = $this->recaptcha()->active('acquisition');
+
+        // Process form submission
+        if ($this->formWasSubmitted('submit', $view->useRecaptcha)) {
+
+            // Collect the data submitted by form
+            $params['field_of_study'] = !empty($view->acquisitionFieldOfStudy) ? $view->acquisitionFieldOfStudy : '';
+            $params['proposal']       = !empty($view->acquisitionProposal)     ? $view->acquisitionProposal     : '';
+            $params['statement']      = !empty($view->acquisitionStatement)    ? $view->acquisitionStatement    : '';
+
+            // Validate data submitted by form
+            $isValid = true;
+            $validatorStrLength = new StringLength(['min' => 10]);
+            $validatorIdentical = new Identical('-1');
+
+            if (!$validatorStrLength->isValid($params['proposal'])) {
+                $this->flashMessenger()
+                    ->addMessage('PDA::pda_error_proposal_blank', 'error');
+                $isValid = false;
+            }
+            if (!$validatorStrLength->isValid($params['statement'])) {
+                $this->flashMessenger()
+                    ->addMessage('PDA::pda_error_statement_blank', 'error');
+                $isValid = false;
+            }
+            if ($validatorIdentical->isValid($params['field_of_study'])) {
+                $this->flashMessenger()
+                    ->addMessage('PDA::pda_error_field_of_study_blank', 'error');
+                $isValid = false;
+            }
+            if (!$isValid) {
+                $view->setTemplate('myresearch/acquisition');
+                return $view;
+            }
+
+            // All params are valid, set timestamp for current params set
+            $params['timestamp'] = date('d.m.Y H:i');
+
+            // Attempt to send the email and show an appropriate flash message:
+            try {
+                $this->sendAcquisitionEmail($params);
+                $this->flashMessenger()->addMessage('PDA::pda_send_success', 'success');
+                return $this->forwardTo('myresearch', 'home');
+            } catch (MailException $e) {
+                $this->flashMessenger()->addMessage($e->getMessage(), 'error');
+            }
+        }
+
+        // Display the template:
+        $view->setTemplate('myresearch/acquisition');
+        return $view;
+    }
+
+    /**
+     * Create a new ViewModel to use as Acquisition form.
+     *
+     * @param array  $params         Parameters to pass to ViewModel constructor.
+     *
+     * @return ViewModel
+     */
+    protected function createAcquisitionViewModel($params = null)
+    {
+        // Build view:
+        $view = $this->createViewModel($params);
+
+        // Load configuration:
+        $config = $this->getServiceLocator()->get('VuFind\Config')->get('config');
+
+        $view->fieldOfStudyList = isset($config->CustomSite->field_of_study)
+            ? $config->CustomSite->field_of_study->toArray() : [];
+
+        // Send parameters back to view so form can be re-populated:
+        if ($this->getRequest()->isPost()) {
+            $view->acquisitionFieldOfStudy = $this->params()->fromPost('field_of_study');
+            $view->acquisitionProposal = $this->params()->fromPost('proposal');
+            $view->acquisitionStatement = $this->params()->fromPost('reasons');
+        }
+
+        return $view;
+    }
+
+    /**
+     * Send Acquisition order via e-mail.
+     *
+     * @param $params Data to be used for Email template
+     *
+     * @return void
+     * @throws MailException
+     */
+    protected function sendAcquisitionEmail($params)
+    {
+        $emailProfile = $this->getEmailProfile('Acquisition');
+        $renderer = $this->getViewRenderer();
+
+        // Custom template for emails (html-only)
+        $bodyHtml = $renderer->render(
+            'Email/acquisition-html.phtml', $params
+        );
+        // Custom template for emails (text-only)
+        $bodyPlain = $renderer->render(
+            'Email/acquisition-text.phtml', $params
+        );
+
+        // Build the subject
+        $subject = (isset($emailProfile->subject))
+            ? sprintf(
+                $emailProfile->subject,
+                $this->translate('PDA::fos_' . $params['field_of_study']),
+                $params['username']
+            ) : $this->translate('PDA::pda_form_title');
+
+        // Set reply address and name if available
+        $reply = (isset($params['email'], $params['firstname'], $params['lastname']))
+            ? new Address($params['email'], $params['firstname'] . ' ' . $params['lastname'])
+            : null;
+
+        // Get mailer
+        $mailer = new Mailer(
+            $this->getServiceLocator()
+                ->get('VuFind\Mailer')->getTransport()
+        );
+
+        // Send the email
+        $mailer->sendTextHtml(
+            new Address($emailProfile->to),
+            new Address($emailProfile->from),
+            $reply,
+            $subject,
+            $bodyHtml,
+            $bodyPlain
+        );
+    }
+}
diff --git a/module/finc/src/finc/Controller/EblTrait.php b/module/finc/src/finc/Controller/CustomTraits/EblTrait.php
similarity index 98%
rename from module/finc/src/finc/Controller/EblTrait.php
rename to module/finc/src/finc/Controller/CustomTraits/EblTrait.php
index c150515e29c..c1e33fbb6c0 100644
--- a/module/finc/src/finc/Controller/EblTrait.php
+++ b/module/finc/src/finc/Controller/CustomTraits/EblTrait.php
@@ -27,7 +27,7 @@
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-namespace finc\Controller;
+namespace finc\Controller\CustomTraits;
 
 /**
  * Ebl Trait
diff --git a/module/finc/src/finc/Controller/EmailHoldTrait.php b/module/finc/src/finc/Controller/CustomTraits/EmailHoldTrait.php
similarity index 98%
rename from module/finc/src/finc/Controller/EmailHoldTrait.php
rename to module/finc/src/finc/Controller/CustomTraits/EmailHoldTrait.php
index a3ef5ffb34a..de142a8f09d 100644
--- a/module/finc/src/finc/Controller/EmailHoldTrait.php
+++ b/module/finc/src/finc/Controller/CustomTraits/EmailHoldTrait.php
@@ -27,8 +27,9 @@
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     https://vufind.org Main Site
  */
-namespace finc\Controller;
-use finc\Mailer\Mailer as Mailer,
+namespace finc\Controller\CustomTraits;
+use VuFind\Exception\Mail as MailException,
+    finc\Mailer\Mailer as Mailer,
     Zend\Mail\Address as Address;
 
 /**
diff --git a/module/finc/src/finc/Controller/CustomTraits/EmailProfileTrait.php b/module/finc/src/finc/Controller/CustomTraits/EmailProfileTrait.php
new file mode 100644
index 00000000000..ec5b64159e1
--- /dev/null
+++ b/module/finc/src/finc/Controller/CustomTraits/EmailProfileTrait.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * EmailProfile Trait
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2010.
+ * Copyright (C) Leipzig University Library 2015.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   André Lahmann <lahmann@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+namespace finc\Controller\CustomTraits;
+
+/**
+ * EmailProfile Trait
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   André Lahmann <lahmann@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+trait EmailProfileTrait
+{
+    /*
+     * Important:
+     * Usage of this Trait requires that the including class implements the
+     * Zend\Log\LoggerAwareInterface and uses VuFind\Log\LoggerAwareTrait
+     */
+
+    /**
+     * Returns the email profile configured in MailForms.ini
+     *
+     * @param $profile
+     * @return array
+     */
+    protected function getEmailProfile($profile)
+    {
+        $mailConfig
+            = $this->getServiceLocator()->get('VuFind\Config')->get('EmailProfiles');
+
+        if (isset($mailConfig->$profile)) {
+            return $mailConfig->$profile;
+        } else {
+            $this->debug('Missing email profile: ' + $profile);
+            return [];
+        }
+    }
+}
diff --git a/module/finc/src/finc/Controller/PdaTrait.php b/module/finc/src/finc/Controller/CustomTraits/PdaTrait.php
similarity index 85%
rename from module/finc/src/finc/Controller/PdaTrait.php
rename to module/finc/src/finc/Controller/CustomTraits/PdaTrait.php
index 9e8e71a9a4f..3b3f67e4d32 100644
--- a/module/finc/src/finc/Controller/PdaTrait.php
+++ b/module/finc/src/finc/Controller/CustomTraits/PdaTrait.php
@@ -28,12 +28,12 @@
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     http://vufind.org   Main Site
  */
-namespace finc\Controller;
+namespace finc\Controller\CustomTraits;
 use VuFind\Exception\Mail as MailException,
+    finc\Mailer\Mailer,
     Zend\Mail\Address,
     Zend\Validator\StringLength,
-    Zend\Validator\Identical,
-    finc\Mailer\Mailer;
+    Zend\Validator\Identical;
 
 /**
  * PDA Trait
@@ -62,11 +62,6 @@ trait PdaTrait
      */
     public function pdaAction()
     {
-        // Stop now if the user does not have valid catalog credentials available:
-        if (!is_array($patron = $this->catalogLogin())) {
-            return $patron;
-        }
-
         // Check with the set accessPermission if the user is authorized to use PDA
         $accessPermission = 'access.PDAForm';
 
@@ -88,25 +83,28 @@ trait PdaTrait
 
         // User is authorized to use PDA
 
+        // Do we have valid catalog credentials - if we do, use the catalog user data
+        // for the form instead
+        if (is_array($patron = $this->catalogLogin())) {
+            $catalog = $this->getILS();
+            $profile = $catalog->getMyProfile($patron);
+        }
+
         // Start collecting params for PDA
-        $catalog = $this->getILS();
-        $profile = $catalog->getMyProfile($patron);
 
         // prefer profile data from ILS over user data from db
         $params = [
             'username'  => trim($user->cat_username),
             'email'     => isset($profile['email'])
-                ? $profile['email'] : trim($user->email),
+                ? trim($profile['email']) : trim($user->email),
             'firstname' => isset($profile['firstname'])
-                ? $profile['firstname'] : trim($user->firstname),
+                ? trim($profile['firstname']) : trim($user->firstname),
             'lastname'  => isset($profile['lastname'])
-                ? $profile['lastname'] : trim($user->lastname)
+                ? trim($profile['lastname']) : trim($user->lastname),
+            'group' => isset($profile['group'])
+                ? trim($profile['group']) : ''
         ];
 
-        if (isset($profile['group'])) {
-            $params['group'] = $profile['group'];
-        }
-
         // Create view
         $view = $this->createPDAEmailViewModel();
 
@@ -136,21 +134,18 @@ trait PdaTrait
                     ->addMessage('PDA::pda_error_field_of_study_blank', 'error');
                 $isValid = false;
             }
-            if (!$isValid) {
-                $view->setTemplate('record/pdaform');
-                return $view;
-            }
-
-            // All params are valid, set timestamp for current params set
-            $params['timestamp'] = date('d.m.Y H:i');
+            if ($isValid) {
+                // All params are valid, set timestamp for current params set
+                $params['timestamp'] = date('d.m.Y H:i');
 
-            // Attempt to send the email and show an appropriate flash message:
-            try {
-                $this->sendPdaEmail($params);
-                $this->flashMessenger()->addMessage('PDA::pda_send_success', 'success');
-                return $this->redirectToRecord();
-            } catch (MailException $e) {
-                $this->flashMessenger()->addMessage($e->getMessage(), 'error');
+                // Attempt to send the email and show an appropriate flash message:
+                try {
+                    $this->sendPdaEmail($params);
+                    $this->flashMessenger()->addMessage('PDA::pda_send_success', 'success');
+                    return $this->redirectToRecord();
+                } catch (MailException $e) {
+                    $this->flashMessenger()->addMessage($e->getMessage(), 'error');
+                }
             }
         }
 
diff --git a/module/finc/src/finc/Controller/CustomTraits/ReportErrorsTrait.php b/module/finc/src/finc/Controller/CustomTraits/ReportErrorsTrait.php
new file mode 100644
index 00000000000..b8eb0a65022
--- /dev/null
+++ b/module/finc/src/finc/Controller/CustomTraits/ReportErrorsTrait.php
@@ -0,0 +1,210 @@
+<?php
+/**
+ * ReportErrors Trait
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Leipzig University Library 2015.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   Gregor Gawol <gawol@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org/wiki/vufind2:record_drivers Wiki
+ * @SuppressWarnings(PHPMD.ExcessivePublicCount)
+ */
+namespace finc\Controller\CustomTraits;
+use VuFind\Exception\Mail as MailException,
+    finc\Mailer\Mailer,
+    Zend\Mail\Address,
+    Zend\Validator\StringLength,
+    Zend\Validator\Identical;
+
+/**
+ * ReportErrors Trait
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   Gregor Gawol <gawol@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org/wiki/vufind2:record_drivers Wiki
+ * @SuppressWarnings(PHPMD.ExcessivePublicCount)
+ */
+trait ReportErrorsTrait
+{
+    /**
+     * PDA action - controller method
+     *
+     * @return \Zend\View\Model\ViewModel
+     */
+    public function reportErrorsAction()
+    {
+        // Force login if necessary:
+        $config = $this->getConfig();
+        if ((!isset($config->Mail->require_login) || $config->Mail->require_login)
+            && !$this->getUser()
+        ) {
+            return $this->forceLogin();
+        }
+
+        $params['email'] = null;
+        if ($user = $this->getUser()) {
+            $params['email'] = trim($user->email);
+        }
+
+        // Create view
+        $view = $this->createReportErrorsEmailViewModel($params);
+
+        // Set up reCaptcha
+        //todo: testen!
+        $view->useRecaptcha = $this->recaptcha()->active('reportErrors');
+
+        // Process form submission
+        if ($this->formWasSubmitted('submit', $view->useRecaptcha)) {
+
+            // Collect the data submitted by form
+            $params['reply_requested'] = $view->reply_requested;
+            $params['email']  = !empty($view->email) ? $view->email : '';
+            if ($view->reply_requested) {
+                if ($user) {
+                    $params['firstname'] = trim($user->firstname);
+                    $params['lastname'] = trim($user->lastname);
+                }
+            }
+            $params['comment']    = !empty($view->comment) ? $view->comment : '';
+
+            // Validate data submitted by form
+            $validatorStrLength = new StringLength(['min' => 10]);
+
+            if (!$validatorStrLength->isValid($params['comment'])) {
+                $this->flashMessenger()
+                    ->addMessage('report_errors_comment_blank', 'error');
+            } else {
+                // All params are valid, set timestamp for current params set
+                $params['timestamp'] = date('d.m.Y H:i');
+
+                // Attempt to send the email and show an appropriate flash message:
+                try {
+                    $this->sendReportErrorsEmail($params);
+                    $this->flashMessenger()->addMessage('report_errors_send_success', 'success');
+                    return $this->redirectToRecord();
+                } catch (MailException $e) {
+                    $this->flashMessenger()->addMessage($e->getMessage(), 'error');
+                }
+            }
+        }
+
+        // Display the template:
+        $view->setTemplate('record/reporterrorsform');
+        return $view;
+    }
+
+    /**
+     * Create a new ViewModel to use as a PDA-Email form.
+     *
+     * @param array  $params         Parameters to pass to ViewModel constructor.
+     *
+     * @return ViewModel
+     */
+    protected function createReportErrorsEmailViewModel($params = null)
+    {
+        // Build view:
+        $view = $this->createViewModel($params);
+
+        // Send parameters back to view so form can be re-populated:
+        if ($this->getRequest()->isPost()) {
+            $view->email = $this->params()->fromPost('reporterrors_email');
+            $view->reply_requested = ($this->params()->fromPost('reporterrors_checkbox') ? true : false);
+            $view->comment = $this->params()->fromPost('comment');
+        }
+
+        return $view;
+    }
+
+    /**
+     * Send PDA order via e-mail.
+     *
+     * @param $params Data to be used for Email template
+     *
+     * @return void
+     * @throws MailException
+     */
+    protected function sendReportErrorsEmail($params)
+    {
+        $emailProfile = $this->getEmailProfile('ReportErrors');
+        $renderer = $this->getViewRenderer();
+
+        // Collect the records metadata
+        $keyMethodMapper = [
+            'id'            => 'getUniqueID',
+            'author'        => 'getCombinedAuthors',
+            'title'         => 'getTitle',
+            'title_short'   => 'getShortTitle'
+        ];
+        $driver = $this->loadRecord();
+        foreach ($keyMethodMapper as $var => $method) {
+            $params[$var] = $driver->tryMethod($method);
+        }
+        $params['driver'] = $driver;
+
+        // Custom template for emails (html-only)
+        $bodyHtml = $renderer->render(
+            'Email/reporterrors-html.phtml', $params
+        );
+        // Custom template for emails (text-only)
+        $bodyPlain = $renderer->render(
+            'Email/reporterrors-plain.phtml', $params
+        );
+
+        // Build the subject
+        $subject = (isset($emailProfile->subject))
+            ? sprintf(
+                $emailProfile->subject,
+                $params['title_short'],
+                $params['id'],
+                ($params['reply_requested'] == true 
+                    ? $this->translate('reporterrors_response_requested_subject') 
+                    : ''
+                )
+            ) : $this->translate('ReportErrors');
+
+        // Set reply address and name if available
+        if ($params['reply_requested'] == true) {
+            $replyTo = !empty($params['email']) ? $params['email'] : $emailProfile->from;
+            $replyToName
+                = (isset($params['firstname']) && isset($params['lastname'])) && !empty($replyTo)
+                ? $params['firstname'] . ' ' . $params['lastname']
+                : '';
+            $reply = new Address($replyTo, $replyToName);
+        }
+
+        // Get mailer
+        $mailer = new Mailer(
+            $this->getServiceLocator()
+                ->get('VuFind\Mailer')->getTransport()
+        );
+
+        // Send the email
+        $mailer->sendTextHtml(
+            new Address($emailProfile->to),
+            new Address($emailProfile->from),
+            isset($reply) ? $reply : $emailProfile->from,
+            $subject,
+            $bodyHtml,
+            $bodyPlain
+        );
+    }
+}
diff --git a/module/finc/src/finc/Controller/CustomTraits/ResetPasswordTrait.php b/module/finc/src/finc/Controller/CustomTraits/ResetPasswordTrait.php
new file mode 100644
index 00000000000..36f6720c257
--- /dev/null
+++ b/module/finc/src/finc/Controller/CustomTraits/ResetPasswordTrait.php
@@ -0,0 +1,201 @@
+<?php
+/**
+ * ResetPassword Trait
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2010.
+ * Copyright (C) Leipzig University Library 2015.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @author   Frank Morgner <morgnerf@ub.uni-leipzig.de>
+ * @author   André Lahmann <lahmann@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+namespace finc\Controller\CustomTraits;
+use VuFind\Exception\Mail as MailException,
+    finc\Mailer\Mailer,
+    Zend\Mail\Address,
+    Zend\Validator\Identical,
+    Zend\Validator\EmailAddress;
+
+/**
+ * ResetPassword Trait
+ *
+ * @category VuFind
+ * @package  Controller
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @author   Frank Morgner <morgnerf@ub.uni-leipzig.de>
+ * @author   André Lahmann <lahmann@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     http://vufind.org   Main Site
+ */
+trait ResetPasswordTrait
+{
+    /**
+     * Profile to be used for email
+     */
+    //const ACQUISITION_EMAIL_PROFILE = 'ResetPassword';
+
+    /**
+     * Reset password action - Allows the reset password form to appear.
+     *
+     * @return \Zend\View\Model\ViewModel
+     */
+    public function resetPasswordAction()
+    {
+        // Create view
+        $view = $this->createResetPasswordViewModel();
+
+        // Set up reCaptcha
+        //todo: testen!
+        $view->useRecaptcha = $this->recaptcha()->active('resetPassword');
+
+        // Process form submission:
+        if ($this->formWasSubmitted('submit', $view->useRecaptcha)) {
+
+            $params = [
+                'firstname' => !empty($view->firstname) ? $view->firstname : '',
+                'lastname'  => !empty($view->lastname)  ? $view->lastname  : '',
+                'username'  => !empty($view->username)  ? $view->username  : '',
+                'email'     => !empty($view->email)     ? $view->email     : ''
+            ];
+
+            // Validate data submitted by form
+            $isValid = true;
+            $validatorIdentical = new Identical('');
+            $validatorEmailAddress = new EmailAddress();
+
+            if ($validatorIdentical->isValid($params['firstname'])) {
+                $this->flashMessenger()
+                    ->addMessage('Please enter your firstname.', 'error');
+                $isValid = false;
+            }
+            if ($validatorIdentical->isValid($params['lastname'])) {
+                $this->flashMessenger()
+                    ->addMessage('Please enter your lastname.', 'error');
+                $isValid = false;
+            }
+            if ($validatorIdentical->isValid($params['username'])) {
+                $this->flashMessenger()
+                    ->addMessage('Please enter your library card number.', 'error');
+                $isValid = false;
+            }
+            if (!$validatorEmailAddress->isValid($params['email'])) {
+                $this->flashMessenger()
+                    ->addMessage('Please enter a valid email address.', 'error');
+                $isValid = false;
+            }
+            if (!$isValid) {
+                $view->setTemplate('Auth/AbstractBase/resetpassword');
+                return $view;
+            }
+
+            $params['timestamp'] = date('d.m.Y H:i');
+
+            // Attempt to send the email and show an appropriate flash message:
+            try {
+                $this->sendResetPasswordEmail($params);
+                $this->flashMessenger()->addMessage('reset_password_text', 'success');
+                return $this->forwardTo('myresearch', 'home');
+            } catch (MailException $e) {
+                $this->flashMessenger()->addMessage($e->getMessage(), 'error');
+            }
+        }
+
+        // Display the template:
+        $view->setTemplate('Auth/AbstractBase/resetpassword');
+        return $view;
+    }
+
+    /**
+     * Create a new ViewModel to use as ResetPassword form.
+     *
+     * @param array  $params         Parameters to pass to ViewModel constructor.
+     *
+     * @return ViewModel
+     */
+    protected function createResetPasswordViewModel($params = null)
+    {
+        // Build view:
+        $view = $this->createViewModel($params);
+
+        // Send parameters back to view so form can be re-populated:
+        if ($this->getRequest()->isPost()) {
+            $view->firstname = $this->params()->fromPost('firstname');
+            $view->lastname  = $this->params()->fromPost('lastname');
+            $view->username  = $this->params()->fromPost('username');
+            $view->email     = $this->params()->fromPost('email');
+        }
+
+        return $view;
+    }
+
+    /**
+     * Send ResetPassword e-mail.
+     *
+     * @param $params Data to be used for Email template
+     *
+     * @return void
+     * @throws MailException
+     */
+    protected function sendResetPasswordEmail($params)
+    {
+        $emailProfile = $this->getEmailProfile('ResetPassword');
+        $renderer = $this->getViewRenderer();
+
+        // Custom template for emails (html-only)
+        $bodyHtml = $renderer->render(
+            'Email/resetpassword-html.phtml', $params
+        );
+        // Custom template for emails (text-only)
+        $bodyPlain = $renderer->render(
+            'Email/resetpassword-plain.phtml', $params
+        );
+
+        // Build the subject
+        $subject = (isset($emailProfile->subject))
+            ? sprintf(
+                $emailProfile->subject,
+                $params['firstname'],
+                $params['lastname']
+            ) : $this->translate('Reset Password');
+
+        // Set reply address and name if available
+        $reply = (isset($params['email'], $params['firstname'], $params['lastname']))
+            ? new Address($params['email'], $params['firstname'] . ' ' . $params['lastname'])
+            : null;
+
+        // Get mailer
+        $mailer = new Mailer(
+            $this->getServiceLocator()
+                ->get('VuFind\Mailer')->getTransport()
+        );
+
+        // Send the email
+        $mailer->sendTextHtml(
+            new Address($emailProfile->to),
+            new Address($emailProfile->from),
+            $reply,
+            $subject,
+            $bodyHtml,
+            $bodyPlain
+        );
+    }
+}
diff --git a/module/finc/src/finc/Controller/DocumentDeliveryServiceController.php b/module/finc/src/finc/Controller/DocumentDeliveryServiceController.php
index d516bc7025f..3868dceab8c 100644
--- a/module/finc/src/finc/Controller/DocumentDeliveryServiceController.php
+++ b/module/finc/src/finc/Controller/DocumentDeliveryServiceController.php
@@ -28,9 +28,8 @@
  */
 namespace finc\Controller;
 
-//use ZfcRbac\Service\AuthorizationServiceAwareInterface as AuthorizationServiceAwareInterface;
-//use ZfcRbac\Service\AuthorizationServiceAwareTrait as AuthorizationServiceAwareTrait;
-use finc\Exception\DDS as DDSException,
+use VuFind\Exception\Mail as MailException,
+    finc\Exception\DDS as DDSException,
     finc\Mailer\Mailer as Mailer,
     Zend\Mail\Address as Address,
     Zend\Validator as Validator;
@@ -213,9 +212,13 @@ class DocumentDeliveryServiceController extends \VuFind\Controller\AbstractBase
         $email['from'] = $this->getConfigVar('DDS','from');
         $email['subject'] = $this->setSubjectEmail($departmentdetails);
         $email['to'] = $this->setRecipientEmail($departmentdetails);
-        $email['body'] = $body['order'];
-        $email['reply'] = $content['email'];
-        $email['replyname'] = $content['name'];
+        $email['text'] = $body['text'];
+        $email['html'] = $body['html'];
+        $email['reply'] = (isset($content['name']) && !empty($content['name']))
+            ? new Address(
+                $content['email'],
+                $content['name']
+            ) : new Address($content['email']) ;
 
         try {
             // Send Email
@@ -226,10 +229,10 @@ class DocumentDeliveryServiceController extends \VuFind\Controller\AbstractBase
             $mailer->sendTextHtml(
                 $email['to'],
                 $email['from'],
-                new Address($email['reply'], $email['replyname']),
+                $email['reply'],
                 $email['subject'],
-                '', //$bodyHtml,
-                $email['body']
+                $email['html'],
+                $email['text']
             );
 
             $this->sendOrderToApi($content);
@@ -339,9 +342,12 @@ class DocumentDeliveryServiceController extends \VuFind\Controller\AbstractBase
         $renderer = $this->getViewRenderer();
 
         // Custom template for emails
-        $body['order'] = $renderer->render(
+        $body['text'] = $renderer->render(
             'Email/dds-text.phtml', $details
         );
+        $body['html'] = $renderer->render(
+            'Email/dds-html.phtml', $details
+        );
         /*$body['customer'] = $renderer->render(
             'Email/dds-confirmation-text.phtml', $details
         );*/
diff --git a/module/finc/src/finc/Controller/MyResearchController.php b/module/finc/src/finc/Controller/MyResearchController.php
index fc7f9b71ae3..2ab018628ea 100644
--- a/module/finc/src/finc/Controller/MyResearchController.php
+++ b/module/finc/src/finc/Controller/MyResearchController.php
@@ -26,12 +26,7 @@
  * @link     https://vufind.org Main Site
  */
 namespace finc\Controller;
-
-use finc\Mailer\Mailer,
-    VuFind\Exception\Mail as MailException,
-    Zend\I18n\Validator\IsInt,
-    Zend\Mail\Address,
-    Zend\Validator\StringLength;
+use Zend\Log\LoggerAwareInterface as LoggerAwareInterface;
 
 /**
  * Controller for the user account area.
@@ -39,256 +34,14 @@ use finc\Mailer\Mailer,
  * @category VuFind
  * @package  Controller
  * @author   Demian Katz <demian.katz@villanova.edu>
- * @author   Gregor Gawol <gawol@ub.uni-leipzig.de>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     https://vufind.org Main Site
  */
-class MyResearchController extends \VuFind\Controller\MyResearchController
+class MyResearchController extends \VuFind\Controller\MyResearchController implements
+    LoggerAwareInterface
 {
-
-    /**
-     * Subjects
-     *
-     * @var array
-     */
-    private $_subjectlist = [];
-
-    /**
-     * Returns the subject list generated by config setting in Acquisition section.
-     * Rebuilds the subject list if it's empty.
-     *
-     * @return array
-     */
-    private function _getSubjectList()
-    {
-        if (count($this->_subjectlist) <= 0) {
-            $this->_subjectlist = (isset($this->getConfig()->CustomSite->field_of_study)
-                ? $this->getConfig()->CustomSite->field_of_study->toArray() : []
-            );
-        }
-        return $this->_subjectlist;
-    }
-
-    /**
-     * Send a acquisition proposal
-     *
-     * @return mixed
-     */
-    public function acquisitionAction()
-    {
-        // Force login:
-        $user = $this->getUser();
-        if (!$user) {
-            return $this->forceLogin();
-        }
-
-        // Process save action if necessary:
-        if ($this->formWasSubmitted('submit')) {
-            return $this->processAcquisition($user);
-        }
-
-        return $this->createViewModel(
-            [
-                'subjectlist' => $this->_getSubjectList()
-            ]
-        );
-    }
-
-    /**
-     * Helper function acquisitionAction
-     *
-     * @param \VuFind\Db\Row\User $user logged in user
-     *
-     * @return \Zend\View\Model\ViewModel
-     * @throws \VuFind\Exception\Mail
-     */
-    protected function processAcquisition($user)
-    {
-        $validatorAlnum = new IsInt();
-        $validatorString = new StringLength(['min' => 1]);
-        $valueArr = [];
-
-        $subject = $this->params()->fromPost('subject');
-        $valueArr['subject'] = $subject;
-        $proposal = $this->params()->fromPost('proposal');
-        $valueArr['proposal'] = $proposal;
-        $reasons = $this->params()->fromPost('reasons');
-        $valueArr['reasons'] = $reasons;
-        $error = false;
-
-        if ($validatorAlnum->isValid($subject)) {
-            $this->flashMessenger()->addMessage(
-                'PDA::pda_error_subject_blank', 'error'
-            );
-            $error = true;
-        }
-        if (!$validatorString->isValid($proposal)) {
-            $this->flashMessenger()->addMessage(
-                'PDA::pda_error_proposal_blank', 'error'
-            );
-            $error = true;
-        }
-        if (!$validatorString->isValid($reasons)) {
-            $this->flashMessenger()->addMessage(
-                'PDA::pda_error_statement_blank', 'error'
-            );
-            $error = true;
-        }
-
-        if (!$error) {
-            // send email
-            try {
-                $config = $this->getConfig();
-                $renderer = $this->getViewRenderer();
-                // Custom template for emails (html-only)
-                $message_html = $renderer->render(
-                    'Email/acquisition-html.phtml',
-                    [
-                        'user' => $user,
-                        'subject' => $this->translate($subject),
-                        'proposal' => $proposal,
-                        'reasons' => $reasons,
-                        'time' => date('d.m.Y H:i')
-                    ]
-                );
-                // Custom template for emails (text-only)
-                $message_text = $renderer->render(
-                    'Email/acquisition-text.phtml',
-                    [
-                        'user' => $user,
-                        'subject' => $this->translate($subject),
-                        'proposal' => $proposal,
-                        'reasons' => $reasons,
-                        'time' => date('d.m.Y H:i')
-                    ]
-                );
-                $subject = (
-                    isset($config->Acquisition->subject_acquisition)
-                        ? sprintf(
-                            $config->Acquisition->subject_acquisition,
-                            $this->translate($subject), $user->username
-                        )
-                        : $this->translate('PDA::pda_form_title')
-                );
-                
-                $from_unknown = (isset($config->Acquisition->from_unknown)
-                    ? $config->Acquisition->from_unknown : '');
-                $from = $reply = (isset($user->email))
-                    ? new Address($user->email, $user->firstname . ' ' . $user->lastname) 
-                    : new Address($from_unknown);
-
-                $to = (isset($config->Acquisition->to))
-                    ? new Address($config->Acquisition->to)
-                    : '';
-
-                $mailer = new Mailer(
-                    $this->getServiceLocator()
-                        ->get('VuFind\Mailer')->getTransport()
-                );
-                
-                $mailer->sendTextHtml(
-                    $to,
-                    $from,
-                    $reply,
-                    $subject,
-                    $message_html,
-                    $message_text
-                );
-                $this->flashMessenger()->addMessage('PDA::pda_send_success', 'info');
-            } catch (MailException $e) {
-                $this->flashMessenger()->addMessage($e->getMessage(), 'error');
-            }
-        }
-
-        return $this->createViewModel(
-            [
-                'subjectlist' => $this->_getSubjectList(),
-                'values' => $valueArr
-            ]
-        );
-    }
-
-    /**
-     * Reset password action - Allows the reset password form to appear.
-     *
-     * @return \Zend\View\Model\ViewModel
-     */
-    public function resetPasswordAction()
-    {
-        // Force login if necessary:
-        $mailConfig = $this->getServiceLocator()
-            ->get('VuFind\Config')->get('EmailProfiles');
-
-        if (isset($mailConfig->ResetPassword)) {
-            $emailProfile = $mailConfig->ResetPassword;
-        } else {
-            throw new MailException('Missing email profile: ResetPassword');
-        }
-
-        $view = $this->createViewModel();
-        
-        // Set up reCaptcha
-        $view->useRecaptcha = $this->recaptcha()->active('email');
-
-        // Process form submission:
-        if ($this->formWasSubmitted('submit', $view->useRecaptcha)) {
-
-            $renderer = $this->getViewRenderer();
-
-            $params['firstname'] = $view->firstname = $this->params()->fromPost('firstname');
-            $params['lastname']  = $view->lastname  = $this->params()->fromPost('lastname');
-            $params['username']  = $view->username  = $this->params()->fromPost('username');
-            $params['email']     = $view->email     = $this->params()->fromPost('email');
-            $params['timestamp'] = date('d.m.Y H:i');
-
-            // Custom template for emails (html-only)
-            $bodyHtml = $renderer->render(
-                'Email/resetpassword-html.phtml', $params
-            );
-            // Custom template for emails (text-only)
-            $bodyPlain = $renderer->render(
-                'Email/resetpassword-plain.phtml', $params
-            );
-
-            // Build the subject
-            $subject = (isset($emailProfile->subject))
-                ? sprintf(
-                    $emailProfile->subject,
-                    $params['firstname'],
-                    $params['lastname']
-                ) : $this->translate('Reset Password');
-
-            // Set reply address and name if available
-            $reply = (isset($params['email'], $params['firstname'], $params['lastname']))
-                ? new Address($params['email'], $params['firstname'] . ' ' . $params['lastname'])
-                : null;
-            
-            try {
-                // Get mailer
-                $mailer = new Mailer(
-                    $this->getServiceLocator()
-                        ->get('VuFind\Mailer')->getTransport()
-                );
-
-                // Send the email
-                $mailer->sendTextHtml(
-                    new Address($emailProfile->to),
-                    new Address($emailProfile->from),
-                    $reply,
-                    $subject,
-                    $bodyHtml,
-                    $bodyPlain
-                );
-                $this->flashMessenger()->addMessage('email_success', 'success');
-                return $this->forwardTo('MyResearch', 'Home');
-            } catch (MailException $e) {
-                $this->flashMessenger()->addMessage($e->getMessage(), 'error');
-            }
-        }
-
-        // Display the template:
-        $view->setTemplate('Auth/AbstractBase/resetpassword');
-        return $view;
-    }
-    
+    use \VuFind\Log\LoggerAwareTrait;
+    use CustomTraits\AcquisitionTrait;
+    use CustomTraits\EmailProfileTrait;
+    use CustomTraits\ResetPasswordTrait;
 }
diff --git a/module/finc/src/finc/Controller/RecordController.php b/module/finc/src/finc/Controller/RecordController.php
index 55e3b108fca..29abb41cf50 100644
--- a/module/finc/src/finc/Controller/RecordController.php
+++ b/module/finc/src/finc/Controller/RecordController.php
@@ -28,8 +28,7 @@
  * @link     https://vufind.org Main Site
  */
 namespace finc\Controller;
-use VuFind\Exception\Mail as MailException,
-    Zend\Log\LoggerAwareInterface as LoggerAwareInterface;
+use Zend\Log\LoggerAwareInterface as LoggerAwareInterface;
 
 /**
  * Record Controller
@@ -45,9 +44,10 @@ class RecordController extends \VuFind\Controller\RecordController implements
     LoggerAwareInterface
 {
     use \VuFind\Log\LoggerAwareTrait;
-    use EblTrait;
-    use PdaTrait;
-    use EmailHoldTrait;
+    use CustomTraits\EblTrait;
+    use CustomTraits\EmailHoldTrait;
+    use CustomTraits\PdaTrait;
+    use CustomTraits\EmailProfileTrait;
 
     /**
      * Constructor
@@ -60,25 +60,6 @@ class RecordController extends \VuFind\Controller\RecordController implements
         parent::__construct($config);
     }
 
-    /**
-     * Returns the email profile configured in MailForms.ini
-     *
-     * @param $profile
-     * @return array
-     */
-    protected function getEmailProfile($profile)
-    {
-        $mailConfig
-            = $this->getServiceLocator()->get('VuFind\Config')->get('EmailProfiles');
-
-        if (isset($mailConfig->$profile)) {
-            return $mailConfig->$profile;
-        } else {
-            $this->debug('Missing email profile: ' + $profile);
-            return [];
-        }
-    }
-
     /**
      * Returns rewrite object
      *
@@ -88,5 +69,4 @@ class RecordController extends \VuFind\Controller\RecordController implements
     {
         return $this->getServiceLocator()->get('finc\Rewrite');
     }
-
 }
diff --git a/module/finc/src/finc/Mailer/Mailer.php b/module/finc/src/finc/Mailer/Mailer.php
index 6e853833932..bd974f0be9f 100644
--- a/module/finc/src/finc/Mailer/Mailer.php
+++ b/module/finc/src/finc/Mailer/Mailer.php
@@ -110,15 +110,24 @@ class Mailer extends \VuFind\Mailer\Mailer
         // Convert all exceptions thrown by mailer into MailException objects:
         try {
             // Send message
-            $htmlPart = new MimePart($body_html);
-            $htmlPart->type = 'text/html';
-            $htmlPart->charset = 'UTF-8';
+
+            // html body is optional
+            if (!empty($body_html)) {
+                $htmlPart = new MimePart($body_html);
+                $htmlPart->type = 'text/html';
+                $htmlPart->charset = 'UTF-8';
+            }
+
             $textPart = new MimePart($body_text);
             $textPart->type = 'text/plain';
             $textPart->charset = 'UTF-8';
             $body = new MimeMessage();
             $body->addPart($textPart);
-            $body->addPart($htmlPart);
+
+            // html body is optional
+            if (isset($htmlPart)) {
+                $body->addPart($htmlPart);
+            }
 
             $alternativePart = new MimePart($body->generateMessage());
             $alternativePart->type = 'multipart/alternative';
diff --git a/themes/finc/templates/Auth/AbstractBase/resetpassword.phtml b/themes/finc/templates/Auth/AbstractBase/resetpassword.phtml
index 29c1a245f25..c719bf1dd01 100644
--- a/themes/finc/templates/Auth/AbstractBase/resetpassword.phtml
+++ b/themes/finc/templates/Auth/AbstractBase/resetpassword.phtml
@@ -13,25 +13,25 @@ $this->headTitle($this->translate('Reset Password'));
   <div class="row">
     <label class="small-5 medium-2  columns"><?=$this->transEsc('First Name') ?>:</label>
     <div class="small-7 medium-4 columns end">
-      <input type="text" name="firstname" required />
+      <input type="text" name="firstname" <?=isset($firstname) ? 'value="'.$firstname.'" ' : ''?>required />
     </div>
   </div>
   <div class="row">
     <label class="small-5 medium-2  columns"><?=$this->transEsc('Last Name') ?>:</label>
     <div class="small-7 medium-4 columns end">
-      <input type="text" name="lastname" required/>
+      <input type="text" name="lastname" <?=isset($lastname) ? 'value="'.$lastname.'" ' : ''?>required/>
     </div>
   </div>
   <div class="row">
     <label class="small-5 medium-2  columns"><?=$this->transEsc('Username') ?>:</label>
     <div class="small-7 medium-4 columns end">
-      <input type="text" name="username" required/>
+      <input type="text" name="username" <?=isset($username) ? 'value="'.$username.'" ' : ''?>required/>
     </div>
   </div>
   <div class="row">
     <label class="small-5 medium-2  columns"><?=$this->transEsc('Email') ?>:</label>
     <div class="small-7 medium-4 columns end">
-      <input type="email" name="email" required/>
+      <input type="email" name="email" <?=isset($email) ? 'value="'.$email.'" ' : ''?>required/>
     </div>
   </div>
   <?=$this->recaptcha()->html($this->useRecaptcha) ?>
diff --git a/themes/finc/templates/Email/acquisition-html.phtml b/themes/finc/templates/Email/acquisition-html.phtml
index affc37d437b..2892ac6672b 100644
--- a/themes/finc/templates/Email/acquisition-html.phtml
+++ b/themes/finc/templates/Email/acquisition-html.phtml
@@ -1,36 +1,36 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-    "http://www.w3.org/TR/html4/loose.dtd">
+<?=$this->doctype('HTML5')?>
+<html>
 <head>
-    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
     <title>Erwerbungsvorschlag</title>
 </head>
-<body>
+<body style="font-family: Arial, Verdana, sans-serif;">
 <h2>Erwerbungsvorschlag</h2>
 <table>
     <tr valign="top">
         <td>
-            Name: <strong><?=$user->lastname ?>, <?=$user->firstname ?></strong><br />
-            Lesekarte-Nr.: <strong><?=$user->cat_username ?></strong><br />
-            Email: <a href="mailto:<?=$user->email ?>"><?=$user->email ?></a><br />
-            <? /*if ($user->group): ?>Benutzergruppe: <?=$user->group ?><? endif;*/ ?>
+            Name: <strong><?=$lastname ?>, <?=$firstname ?></strong><br />
+            Lesekarte-Nr.: <strong><?=$username ?></strong><br />
+            E-mail: <a href="mailto:<?=$email ?>"><?=$email ?></a><br />
+            <?=(isset($group) && !empty($group)) ? "Benutzergruppe: ". $group . "<br />" : ""?>
         </td>
         <td>&nbsp;</td>
         <td>
             hat folgenden Titel zur Erwerbung empfohlen:<br />
             <br />
-            <strong><?=$proposal ?></strong><br />
+            <strong><?=$proposal?></strong><br />
             <br />
             Begründung für Empfehlung:
             <br /><br />
-            <strong><?=$reasons ?></strong>
+            <strong><?=$statement?></strong>
             <br /><br /><br />
-            für das Fachgebiet: <strong><?=$subject ?></strong><br />
+            für das Fachgebiet: <strong><?=$field_of_study?></strong><br />
             <br />
         </td>
     </tr>
     <tr valign="top">
         <td colspan="3">
-            Zeitpunkt der Bestellung: <?=$time ?>
+            Zeitpunkt der Bestellung: <?=$timestamp ?>
         </td>
     </tr>
 </table>
diff --git a/themes/finc/templates/Email/acquisition-text.phtml b/themes/finc/templates/Email/acquisition-text.phtml
index bcfb3f898f5..b2f30651000 100644
--- a/themes/finc/templates/Email/acquisition-text.phtml
+++ b/themes/finc/templates/Email/acquisition-text.phtml
@@ -1,11 +1,13 @@
 
 == Erwerbungsvorschlag ==
 
-Der Benutzer: <?=$user->lastname ?>, <?=$user->firstname ?>
+Der Benutzer: <?=$lastname ?>, <?=$firstname ?>
 
-Benutzerkarte: <?=$user->cat_username ?>
+Benutzerkarte: <?=$username ?>
 
-E-Mail-Adresse: <?=$user->email ?>
+E-Mail-Adresse: <?=$email ?>
+
+<?=(isset($group) && !empty($group)) ? "Benutzergruppe: ". $group : ""?>
 
 
 hat folgenden Titel zur Erwerbung empfohlen:
@@ -15,9 +17,9 @@ hat folgenden Titel zur Erwerbung empfohlen:
 
 Begründung für Empfehlung:
 
-<?=$reasons ?>
+<?=$statement ?>
 
 
-für den Fachbereich: <?=$subject ?>
+für den Fachbereich: <?=$field_of_study ?>
 
-<? if ($time): ?>Zeitpunkt: <?=$time ?><? endif; ?>
+<?=isset($timestamp) ? "Zeitpunkt: " . $timestamp : "" ?>
diff --git a/themes/finc/templates/Email/acquisitionpda-html.phtml b/themes/finc/templates/Email/acquisitionpda-html.phtml
index 9ee2862a249..723e10121fb 100644
--- a/themes/finc/templates/Email/acquisitionpda-html.phtml
+++ b/themes/finc/templates/Email/acquisitionpda-html.phtml
@@ -1,8 +1,8 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-    "http://www.w3.org/TR/html4/loose.dtd">
+<?=$this->doctype('HTML5')?>
+<html>
 <head>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
-    <title>Zeitschriftenbestellung</title>
+    <title>Benutzergesteuerte Erwerbung</title>
 </head>
 <body style="font-family: Arial, Verdana, sans-serif;">
 <h2 style="padding:10px 0;">Benutzergesteuerte Erwerbung</h2>
@@ -12,7 +12,7 @@
             Name: <strong><?= $lastname ?>, <?= $firstname ?></strong><br/>
             Lesekarte-Nr.: <strong><?= $username ?></strong><br/>
             Email: <a href="mailto:<?= $email ?>"><?= $email ?></a><br/>
-            <?=isset($group) ? "Benutzergruppe: ". $group . "<br/>" : ""?>
+            <?=(isset($group) && !empty($group)) ? "Benutzergruppe: ". $group . "<br/>" : ""?>
             <br/>
             <? if ($statement): ?>
                 Begründung des Benutzers:
diff --git a/themes/finc/templates/Email/dds-html.phtml b/themes/finc/templates/Email/dds-html.phtml
new file mode 100644
index 00000000000..e241c512024
--- /dev/null
+++ b/themes/finc/templates/Email/dds-html.phtml
@@ -0,0 +1,146 @@
+<?=$this->doctype('HTML5')?>
+<html>
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <title><?=$this->translate("Dokumentenlieferdienst")?></title>
+</head>
+<body style="font-family: Arial, Verdana, sans-serif;">
+<p><strong>AUFTRAGGEBER:</strong></p>
+<table width="820" border="0">
+    <tr valign="top">
+        <td width="25%"><strong>Name:</strong></td>
+        <td width="75%"><?=$this->username?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Telefon:</strong></td>
+        <td width="75%"><?=$this->phone?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>E-Mail:</strong></td>
+        <td width="75%"><?=$this->email?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Lesekartennummer:</strong></td>
+        <td width="75%"><?=$this->userid?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Einrichtung:</strong></td>
+        <td width="75%"><?=$this->department?></td>
+    </tr>
+    <? if (($this->group)): ?>
+    <tr valign="top">
+        <td width="25%"><strong>Status:</strong></td>
+        <td width="75%"><?=$this->group?></td>
+    </tr>
+    <? endif; ?>
+</table>
+<hr />
+<p><strong>ANGABEN ZUM GEWÃœNSCHTEN ARTIKEL:<strong></p>
+<table width="820" border="0">
+    <tr valign="top">
+        <td width="25%"><strong>Autor:</strong></td>
+        <td width="75%"><?=$this->author?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Aufsatztitel:</strong></td>
+        <td width="75%"><?=$this->article?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Zeitschriftentitel:</strong></td>
+        <td width="75%"><?=$this->journal?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>ISSN:</strong></td>
+        <td width="75%"><?=$this->issn?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Erscheinungsjahr:</strong></td>
+        <td width="75%"><?=$this->publishdate?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Band/Heft:</strong></td>
+        <td width="75%"><?=$this->number?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Seiten:</strong></td>
+        <td width="75%"><?=$this->pages?></td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Bemerkungen:</strong></td>
+        <td width="75%"><?=$this->remarks?></td>
+    </tr>
+</table>
+
+<p>Literaturbestellung / Dokumentenlieferdienst der UBL<br />
+    Datum: <?=$this->time?></p>
+
+<hr />
+
+<p><strong>BEARBEITUNGSVERMERKE DER BIBLIOTHEK:</strong></p>
+<? if ($this->division == '15'): ?>
+<table width="820" border="0">
+    <tr valign="top">
+        <td width="25%"><strong>Signatur:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Erledigt am:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="25%"><strong>Lieferung an:</strong></td>
+        <td width="75%">zbmed.fernleihe@medizin.uni-leipzig.de oder Ordner X:\ubl-kopien\Medizin</td>
+    </tr>
+</table>
+<? else: ?>
+<table width="820" border="0">
+    <tr valign="top">
+        <td colspan="3">A) WEITERLEITUNG INNERHALB DER UBL:</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Standort:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Signatur:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td colspan="3">B) SUBITO-BESTELLUNG:</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Bestellnummer:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Bestelldatum:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Lieferbibliothek:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Eingang des Artikels:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+    <tr valign="top">
+        <td width="5%">&nbsp;</td>
+        <td width="20%"><strong>Eingang der Rechnung:</strong></td>
+        <td width="75%">&nbsp;</td>
+    </tr>
+</table>
+<? endif; ?>
+<? if (!empty($this->subito_url)): ?>
+<p>
+    Bestelllink für Subito: <a href="<?=$this->subito_url?>"><?=$this->subito_url?></a>
+</p>
+<? endif; ?>
+</body>
+</html>
\ No newline at end of file
diff --git a/themes/finc/templates/Email/journalhold-html.phtml b/themes/finc/templates/Email/journalhold-html.phtml
index b8d3ec14363..7ab26b9f5f4 100644
--- a/themes/finc/templates/Email/journalhold-html.phtml
+++ b/themes/finc/templates/Email/journalhold-html.phtml
@@ -1,5 +1,5 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-    "http://www.w3.org/TR/html4/loose.dtd">
+<?=$this->doctype('HTML5')?>
+<html>
 <head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8">
     <title><?=$this->translate("Zeitschriftenbestellung")?></title>
diff --git a/themes/finc/templates/Email/reporterrors-html.phtml b/themes/finc/templates/Email/reporterrors-html.phtml
new file mode 100644
index 00000000000..a7e1fd0d2a6
--- /dev/null
+++ b/themes/finc/templates/Email/reporterrors-html.phtml
@@ -0,0 +1,55 @@
+<?=$this->doctype('HTML5')?>
+<html>
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+    <title>Fehlermeldung durch Benutzer</title>
+</head>
+<body style="font-family: Arial, Verdana, sans-serif;">
+<h2 style="padding:10px 0;">Fehlermeldung durch Benutzer</h2>
+<table width="800" border="0">
+    <? if ($reply_requested): ?>
+        <? if (isset($lastname) && isset($firstname)): ?>
+    <tr>
+        <td width="30%">Name:</td>
+        <td width="70%"><strong><?=$lastname?>, <?=$firstname?></strong></td>
+    </tr>
+        <? endif; ?>
+        <? if (isset($email)): ?>
+    <tr>
+        <td width="30%">Email:</td>
+        <td width="70%"><a href="mailto:<?=$email?>"><?=$email?></a></td>
+    </tr>
+    <tr>
+        <td width="100%" colspan="2"><strong>Um Rückmeldung wird gebeten.</strong></td>
+    </tr>
+        <? endif; ?>
+    <? endif; ?>
+    <? if ($comment): ?>
+    <tr>
+        <td width="30%">Meldung des Benutzers::</td>
+        <td width="70%"><span style="font-size: 12px"><?= $comment ?></span></td>
+    </tr>
+    <? endif; ?>
+    <tr>
+        <td width="30%">Gemeldeter Titel:</td>
+        <td width="70%">
+            <strong><?= $title ?></strong><br/>
+            <? if ($author): ?>von
+                <? foreach ($author as $auth): ?>
+                    <?= $auth ?>
+                <? endforeach; ?>
+            <? endif; ?><br/>
+            <br/>
+            Link: <a href="<?=$this->serverUrl($this->recordLink()->getUrl($driver))?>" title="<?= $title ?>"><?=$this->serverUrl($this->recordLink()->getUrl($driver))?></a><br/>
+            Katalog-ID: <a href="<?= $this->serverUrl($this->recordLink()->getUrl($driver)) ?>"
+                           title="<?= $title ?>"><?= $id ?></a><br/>
+        </td>
+    </tr>
+    <tr valign="top">
+        <td width="100%" colspan="2">
+            Zeitpunkt der Meldung: <?= $timestamp ?>
+        </td>
+    </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
diff --git a/themes/finc/templates/Email/reporterrors-plain.phtml b/themes/finc/templates/Email/reporterrors-plain.phtml
new file mode 100644
index 00000000000..3bd0a8c5acf
--- /dev/null
+++ b/themes/finc/templates/Email/reporterrors-plain.phtml
@@ -0,0 +1,38 @@
+== Fehlermeldung durch Benutzer ==
+
+<? if ($reply_requested): ?>
+    <? if (isset($lastname) && isset($firstname)): ?>
+
+Name: <?=$lastname?>, <?=$firstname?>
+
+    <? endif; ?>
+    <? if (isset($email)): ?>
+
+Email: <?=$email?>
+
+Um Rückmeldung wird gebeten.
+
+
+    <? endif; ?>
+<? endif; ?>
+
+Gemeldeter Titel:
+
+<?= $title ?>
+
+<? if ($author): ?>
+    von <? foreach ($author as $au): ?><?= $au ?> <? endforeach; ?>
+<? endif; ?>
+
+Link: <?= $this->serverUrl($this->recordLink()->getUrl($driver)) ?>
+
+------------------------------------------
+
+<? if ($comment): ?>
+    Meldung des Benutzers:
+    <?= $comment ?>
+<? endif; ?>
+
+------------------------------------------
+
+Zeitpunkt der Meldung: <?= $timestamp ?>
\ No newline at end of file
diff --git a/themes/finc/templates/Email/resetpassword-html.phtml b/themes/finc/templates/Email/resetpassword-html.phtml
index ed94c043818..ca7f4edddfb 100644
--- a/themes/finc/templates/Email/resetpassword-html.phtml
+++ b/themes/finc/templates/Email/resetpassword-html.phtml
@@ -1,5 +1,5 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-    "http://www.w3.org/TR/html4/loose.dtd">
+<?=$this->doctype('HTML5')?>
+<html>
 <head>
     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
     <title>Zurücksetzen des Passwortes für Benutzer</title>
diff --git a/themes/finc/templates/myresearch/acquisition.phtml b/themes/finc/templates/myresearch/acquisition.phtml
index dd62b072e21..98a47f3e5df 100644
--- a/themes/finc/templates/myresearch/acquisition.phtml
+++ b/themes/finc/templates/myresearch/acquisition.phtml
@@ -16,37 +16,26 @@ $this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') .
             <div class="form-group row">
                 <label class="col-sm-3 medium-3 columns control-label" for="subject"><?=$this->transEsc('PDA::pda_form_field_of_study_label') ?><span class="required">*</span></label>
                 <div class="col-sm-9 medium-9 columns">
-                    <select name="subject" class="form-control auto">
+                    <select name="field_of_study" class="form-control auto">
                         <option value="-1"><?=$this->transEsc('PDA::pda_form_field_of_study_text') ?></option>
-                        <? if (isset($subjectlist) && is_array($subjectlist)): ?>
-                            <? foreach ($subjectlist as $value): ?>
-                                <option value="<?=$this->transEsc("PDA::fos_" . $value)?>" <? if (isset($values['subject']) && ($values['subject'] != '-1') && ($values['subject'] == $value)): ?> selected="selected"<? endif; ?>><?= $this->transEsc('PDA::fos_' . $value) ?></option>
+                        <? if (isset($fieldOfStudyList) && is_array($fieldOfStudyList)): ?>
+                            <? foreach ($fieldOfStudyList as $fieldOfStudy): ?>
+                                <option value="<?=$this->transEsc("PDA::fos_" . $fieldOfStudy)?>" <? if (isset($acquisitionFieldOfStudy) && ($acquisitionFieldOfStudy != '-1') && ($acquisitionFieldOfStudy == $fieldOfStudy)): ?> selected="selected"<? endif; ?>><?= $this->transEsc('PDA::fos_' . $fieldOfStudy) ?></option>
                             <? endforeach; ?>
                         <? endif; ?>
                     </select>
-                    <? /*if (isset($error) && in_array('subjectlist', $error)): ?>
-                        <span class="error-form"><?=$this->transEsc('Subject area should not be blank') ?></span>
-                    <? endif;*/ ?>
                 </div>
             </div>
             <div class="form-group row">
                 <label class="col-sm-3 medium-3 columns control-label" for="acquistion_reasons"><?=$this->transEsc('PDA::pda_form_statement_label') ?><span class="required">*</span></label>
                 <div class="col-sm-9 medium-9 columns">
-                    <textarea id="acquisition_reasons" type="text" cols="50" rows="5" name="reasons"><? if (isset($values['reasons']) && !empty($values['reasons'])): ?><?=$this->transEsc($values['reasons']) ?><? endif; ?></textarea>
-                    <br />
-                    <? /*if (isset($error) && in_array('reasons', $error)): ?>
-                        <span class="error-form"><?=$this->transEsc('Reasons for suggestion not be blank') ?></span>
-                    <? endif;*/ ?>
+                    <textarea id="acquisition_reasons" type="text" cols="50" rows="5" name="reasons"><?=(isset($acquisitionStatement) && !empty($acquisitionStatement)) ? $acquisitionStatement : ''?></textarea>
                 </div>
             </div>
             <div class="form-group row">
                 <label class="col-sm-3 medium-3 columns control-label" for="acquistion_proposal"><?=$this->transEsc('PDA::pda_form_proposal_label') ?><span class="required">*</span></label>
                 <div class="col-sm-9 medium-9 columns">
-                    <textarea id="acquisition_proposal" type="text" cols="50" rows="5" name="proposal"><?=(isset($values['proposal']) && !empty($values['proposal'])) ? $values['proposal'] : ''?></textarea>
-                    <br />
-                    <? /*if (isset($error) && in_array('proposal', $error)): ?>
-                        <span class="error-form"><?=$this->transEsc('Proposal for acquisition should not be blank') ?></span>
-                    <? endif;*/ ?>
+                    <textarea id="acquisition_proposal" type="text" cols="50" rows="5" name="proposal"><?=(isset($acquisitionProposal) && !empty($acquisitionProposal)) ? $acquisitionProposal : ''?></textarea>
                 </div>
             </div>
             <div class="form-group row">
-- 
GitLab