LP#1268636 Add helpful empty search term message
authorBill Erickson <berick@esilibrary.com>
Fri, 17 Jan 2014 14:03:58 +0000 (09:03 -0500)
committerBill Erickson <berick@esilibrary.com>
Tue, 11 Feb 2014 14:24:06 +0000 (09:24 -0500)
When a search is submitted with no query value, instead of silently
redirecting the user the home page, direct the user to the results page
and show a helpful message (within the low-hits template).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/src/templates/opac/parts/result/lowhits.tt2

index 1a8740c..00c4c49 100644 (file)
@@ -392,10 +392,7 @@ sub load_rresults {
 
     } else {
 
-        if (!$query) {
-            return Apache2::Const::OK if $internal;
-            return $self->generic_redirect;
-        }
+        return Apache2::Const::OK unless $query;
 
         # Limit and offset will stay here. Everything else should be part of
         # the query string, not special args.
index 0c7dfb3..5a69351 100644 (file)
                      IF is_advanced OR is_special;
                           l('Sorry, no entries were found for your search.');
                        ELSE;
-                          l('Sorry, no entries were found for [_1].', '<q>' _ qhtml _ '</q>');
+                          IF !qhtml;
+                             l('Please enter a search term in the Search box.');
+                          ELSE;
+                             l('Sorry, no entries were found for [_1].', '<q>' _ qhtml _ '</q>');
+                          END;
                        END;
                    END %]
             </p>