From: Jane Sandberg Date: Fri, 18 Dec 2020 16:57:04 +0000 (-0800) Subject: LP1907979: Fix Search by Instructor setting lookup in OPAC X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3bc270e7f08fa03361a99be8e722e24100bd7bd5;p=evergreen%2Fpines.git LP1907979: Fix Search by Instructor setting lookup in OPAC Previously, the Search Courses screen in the OPAC relied on a locg param in the URL to determine whether or not to display the "Search by Instructor option", defaulting to location id 1 if no such param exists. However, we can also consult physical_loc and other settings to get a more accurate idea of which library's setting we need here. To test: 1) In the Library settings editor, set Course Materials Module Opt In to true for BR1. 2) In the Library settings editor, set Search by Instructor to true for BR1. 3) In eg.conf, add the line: SetEnv physical_loc 4 4) Restart httpd 5) Go to your OPAC. Note that the OPAC is at the BR1 level, and that course search and browse options are available. 6) Click Search courses. 7) Note that only two values are available in the qtype dropdown: Course Name and Course Number. 8) Apply this patch. 9) Repeat steps 5-6. 10) Note that the screen now appropriately consults the value for the "Search by Instructor" setting at the BR1 level, with an "Instructor" value now available in the qtype dropdown. Signed-off-by: Jane Sandberg Signed-off-by: Garry Collum Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/opac/parts/course_search/qtype_selector.tt2 b/Open-ILS/src/templates/opac/parts/course_search/qtype_selector.tt2 index ab0c121b02..003218bfc7 100644 --- a/Open-ILS/src/templates/opac/parts/course_search/qtype_selector.tt2 +++ b/Open-ILS/src/templates/opac/parts/course_search/qtype_selector.tt2 @@ -3,11 +3,7 @@ {value => "course_number", label => l("Course Number"), plural_label => l('Course Numbers'), browse => 1} ]; -IF CGI.param('locg'); - locg = CGI.param('locg'); -ELSE; - locg = 1; -END; +locg = CGI.param('locg') || ctx.physical_loc || ctx.aou_tree.id || 1; IF ctx.get_org_setting(locg, 'circ.course_materials_browse_by_instructor'); query_types.push({