From badf9ad5bd31c977a4c08707749a27ef7ba4f9ff Mon Sep 17 00:00:00 2001
From: Julian Maurice <julian.maurice@biblibre.com>
Date: Fri, 5 Oct 2018 15:18:59 +0200
Subject: [PATCH] Bug 21501: Remove dead code from course reserves module

search_on parameter is not used in any templates so course-reserves.pl
can be simplified a bit

Test plan:
1. Go to course reserves module and verify that it is still working
2. `git grep search_on` should return nothing

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 course_reserves/course-reserves.pl                  | 16 +++-------------
 .../en/modules/course_reserves/course-reserves.tt   | 21 ---------------------
 2 files changed, 3 insertions(+), 34 deletions(-)

diff --git a/course_reserves/course-reserves.pl b/course_reserves/course-reserves.pl
index ca666969d4..0a07d4f419 100755
--- a/course_reserves/course-reserves.pl
+++ b/course_reserves/course-reserves.pl
@@ -39,16 +39,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
-my $search_on = $cgi->param('search_on');
-my %params;
-if ($search_on) {
-    $params{'course_name'} = "%$search_on%";
-}
-
-my $courses = GetCourses(%params);
-if ( $search_on && @$courses == 1 ) {
-    print $cgi->redirect("/cgi-bin/koha/course_reserves/course-details.pl?course_id=" . $courses->[0]->{'course_id'});
-} else {
-    $template->param( courses => $courses );
-    output_html_with_http_headers $cgi, $cookie, $template->output;
-}
+my $courses = GetCourses();
+$template->param( courses => $courses );
+output_html_with_http_headers $cgi, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt
index b1917a4cb8..a5d933522f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt
@@ -29,27 +29,6 @@
                     </div><!-- /toolbar -->
                     [% END %]
 
-                    <!--
-                    <div id="search-toolbar">
-                        <script type="text/javascript">
-                        //<![CDATA[
-                            function submitSearchForm(p_oEvent){
-                                $('#search_courses_form').submit();
-                            }
-
-                            $(document).ready(function(){
-                                newCourseButton = new YAHOO.widget.Button("search_courses");
-                                newCourseButton.on("click", submitSearchForm );
-                            });
-                        //]]>
-                        </script>
-                        <ul class="toolbar">
-                            <li><form id="search_courses_form"><input type="text" name="search_on" id="search_on"></form></li>
-                            <li><a id="search_courses">Search courses</a></li>
-                        </ul>
-                    </div>
-                    -->
-
                     <h1>Courses</h1>
                     <table id="course_reserves_table">
                         <thead>
-- 
2.11.0