From bd6b80c782366dd0b8faca3b7facd4f36767ae2c Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 23 Feb 2016 11:34:55 -0500
Subject: [PATCH] Make sure users see feedback when submitting empty bulk
 options w/ cart disabled. - Resolves VUFIND-1150. - There's probably a better
 way to do this, but this is a bare minimum fix.

---
 module/VuFind/src/VuFind/Controller/CartController.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/module/VuFind/src/VuFind/Controller/CartController.php b/module/VuFind/src/VuFind/Controller/CartController.php
index 49cbba6cd9f..b37b06078b7 100644
--- a/module/VuFind/src/VuFind/Controller/CartController.php
+++ b/module/VuFind/src/VuFind/Controller/CartController.php
@@ -77,6 +77,13 @@ class CartController extends AbstractBase
         // when we're done:
         $this->session->url = $this->getLightboxAwareUrl('cart-home');
 
+        // If the cart is disabled, going to cart home is not going to help us;
+        // use the referer instead.
+        if (!$this->getCart()->isActive()) {
+            $this->session->url
+                = $this->getRequest()->getServer()->get('HTTP_REFERER');
+        }
+
         // Now forward to the requested action:
         if (strlen($this->params()->fromPost('email', '')) > 0) {
             $action = 'Email';
-- 
GitLab