From bbeeeda7b718078c7bc462755c28e2d8adef562c Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 4 Feb 2015 15:20:38 -0500 Subject: [PATCH] Style fix; reduced redundancy. --- module/VuFind/src/VuFind/Controller/AbstractRecord.php | 5 +++-- module/VuFind/src/VuFind/Controller/AjaxController.php | 5 +++-- module/VuFind/src/VuFind/Controller/CartController.php | 5 +++-- module/VuFind/src/VuFind/Controller/SearchController.php | 9 +++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index d91a8eb3f7a..745709238dd 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -365,14 +365,15 @@ class AbstractRecord extends AbstractBase if ($this->formWasSubmitted('submit', $view->useRecaptcha)) { // Attempt to send the email and show an appropriate flash message: try { - $this->getServiceLocator()->get('VuFind\Mailer')->sendRecord( + $mailer = $this->getServiceLocator()->get('VuFind\Mailer'); + $mailer->sendRecord( $view->to, $view->from, $view->message, $driver, $this->getViewRenderer() ); if ($this->params()->fromPost('ccself') && $view->from != $view->to ) { - $this->getServiceLocator()->get('VuFind\Mailer')->sendRecord( + $mailer->sendRecord( $view->from, $view->from, $view->message, $driver, $this->getViewRenderer() ); diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php index e69635185e9..c72f6133c98 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxController.php +++ b/module/VuFind/src/VuFind/Controller/AjaxController.php @@ -1032,14 +1032,15 @@ class AjaxController extends AbstractBase $this->params()->fromPost('source', 'VuFind') ); $view = $this->createEmailViewModel(); - $this->getServiceLocator()->get('VuFind\Mailer')->sendRecord( + $mailer = $this->getServiceLocator()->get('VuFind\Mailer'); + $mailer->sendRecord( $view->to, $view->from, $view->message, $record, $this->getViewRenderer() ); if ($this->params()->fromPost('ccself') && $view->from != $view->to ) { - $this->getServiceLocator()->get('VuFind\Mailer')->sendRecord( + $mailer->sendRecord( $view->from, $view->from, $view->message, $record, $this->getViewRenderer() ); diff --git a/module/VuFind/src/VuFind/Controller/CartController.php b/module/VuFind/src/VuFind/Controller/CartController.php index c60cf83a115..4072ffbcd26 100644 --- a/module/VuFind/src/VuFind/Controller/CartController.php +++ b/module/VuFind/src/VuFind/Controller/CartController.php @@ -216,14 +216,15 @@ class CartController extends AbstractBase // Attempt to send the email and show an appropriate flash message: try { // If we got this far, we're ready to send the email: - $this->getServiceLocator()->get('VuFind\Mailer')->sendLink( + $mailer = $this->getServiceLocator()->get('VuFind\Mailer'); + $mailer->sendLink( $view->to, $view->from, $view->message, $url, $this->getViewRenderer(), 'bulk_email_title' ); if ($this->params()->fromPost('ccself') && $view->from != $view->to ) { - $this->getServiceLocator()->get('VuFind\Mailer')->sendLink( + $mailer->sendLink( $view->from, $view->from, $view->message, $url, $this->getViewRenderer(), 'bulk_email_title' ); diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index b229f15d765..6a68ba63c16 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -113,16 +113,17 @@ class SearchController extends AbstractSearch // Attempt to send the email and show an appropriate flash message: try { // If we got this far, we're ready to send the email: - $this->getServiceLocator()->get('VuFind\Mailer')->sendLink( + $mailer = $this->getServiceLocator()->get('VuFind\Mailer'); + $mailer->sendLink( $view->to, $view->from, $view->message, $view->url, $this->getViewRenderer() ); if ($this->params()->fromPost('ccself') && $view->from != $view->to ) { - $this->getServiceLocator()->get('VuFind\Mailer')->sendLink( - $view->from, $view->from, $view->message, - $view->url, $this->getViewRenderer() + $mailer->sendLink( + $view->from, $view->from, $view->message, + $view->url, $this->getViewRenderer() ); } $this->flashMessenger()->setNamespace('info') -- GitLab