From d7da81123c30b170e9634cef9f171561986146d5 Mon Sep 17 00:00:00 2001 From: Kris Sinnaeve Date: Tue, 14 Sep 2021 11:39:40 +0100 Subject: [PATCH] Bug 35972: Add thesis tables feature This patch adds a new 'Thesis tables' feature to Koha based on the existing 'Course reserves' system. --- C4/CourseReserves.pm | 18 ++- .../bootstrap/en/includes/masthead.inc | 3 + .../en/modules/opac-thesis-table-details.tt | 127 ++++++++++++++++++ .../en/modules/opac-thesis-tables.tt | 86 ++++++++++++ opac/opac-thesis-table-details.pl | 54 ++++++++ opac/opac-thesis-tables.pl | 44 ++++++ 6 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt create mode 100755 opac/opac-thesis-table-details.pl create mode 100755 opac/opac-thesis-tables.pl diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index fac8b849e21..b9f33ba0c62 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -1004,7 +1004,7 @@ sub CountCourseReservesForItem { =head2 SearchCourses - my $courses = SearchCourses( term => $search_term, enabled => 'yes' ); + my $courses = SearchCourses( term => $search_term, enabled => 'yes', thesis_table => 'no' ); =cut @@ -1014,6 +1014,7 @@ sub SearchCourses { my $term = $params{'term'}; my $enabled = $params{'enabled'} || '%'; + my $thesis_table = $params{'thesis_table'} || 'no'; my @params; my $query = " @@ -1042,6 +1043,21 @@ sub SearchCourses { ) AND c.enabled LIKE ? + "; + + if ( $thesis_table eq 'no' ) { + $query .= " + AND + c.department != 'TT' + "; + } else { + $query .= " + AND + c.department = 'TT' + "; + } + + $query .= " GROUP BY c.course_id, c.department, c.course_number, c.section, c.course_name, c.term, c.staff_note, c.public_note, c.students_count, c.enabled, c.timestamp "; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index 670c15fc508..fecd7d2fe59 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -320,6 +320,9 @@ + [% END %] [% IF Koha.Preference( 'OpacBrowser' ) == 1 %]