From fdf1e6639bae55eae64b52759118776c8f1bb49d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 10 Feb 2026 09:28:00 +0000 Subject: [PATCH] Bug 35972: Implement dynamic course type display in OPAC This patch updates the OPAC to use dynamic display text from authorized values instead of hardcoded "Research tables" terminology. Changes to OPAC scripts: 1. opac-thesis-tables.pl: - Uses course_type='RESEARCH_TABLE' instead of thesis_table='yes' - Retrieves display text from authorised_values.lib_opac - Passes course_type_display to template 2. opac-thesis-table-details.pl: - Retrieves course type from course record - Looks up dynamic display text from authorized values - Passes course_type_display to template Changes to OPAC templates: 1. opac-thesis-tables.tt: - Replaced all hardcoded "Research tables" text - Now uses [% course_type_display | html %] variable - Displays terminology from CR_TYPE authorized values 2. opac-thesis-table-details.tt: - Updated breadcrumb to use dynamic display text 3. masthead.inc: - Moved "Research tables" link next to "Course reserves" - Removed duplicate link from suggestions section - Shows when UseCourseReserves preference is enabled - More logical navigation structure Benefits: - Libraries can customize terminology without code changes - Multilingual support via lib_opac field - Consistent with overall course type architecture - Supports future course types (On Display, etc.) --- .../bootstrap/en/includes/masthead.inc | 6 +-- .../en/modules/opac-thesis-table-details.tt | 40 +++++++++++-------- .../en/modules/opac-thesis-tables.tt | 32 +++++++++------ opac/opac-thesis-table-details.pl | 13 +++++- opac/opac-thesis-tables.pl | 16 ++++++-- 5 files changed, 71 insertions(+), 36 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index b58360aec7f..42b18627c31 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -390,6 +390,9 @@ + [% END %] [% IF Koha.Preference( 'OpacBrowser' ) == 1 %] - [% END %] [% END %] [% IF ( Koha.Preference('OPACShowLibraries') && AllPublicBranches.size > 0 ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt index c8b84d1caca..7d5f77517d3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-table-details.tt @@ -7,7 +7,7 @@ [% USE Branches %] [% USE TablesSettings %] [% INCLUDE 'doc-head-open.inc' %] -[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Reserves for [% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Reserves for [% course.course_name | html %][%- IF course.section -%]- [% course.section | html %][%- END -%] [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %] [% Asset.css("css/datatables.css") | $raw %] @@ -24,11 +24,9 @@ Home - + @@ -36,12 +34,12 @@
- -

Reserves for [% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]

+

Reserves for [% course.course_name | html %][%- IF course.section -%]- [% course.section | html %][%- END -%]

    [% IF ( course.instructors ) %] -
  1. Researcher: +
  2. Researcher:
      [% FOREACH i IN course.instructors %]
    • [% i.firstname | html %] [% i.surname | html %]
    • @@ -77,19 +75,24 @@ [% INCLUDE 'biblio-title-head.inc' biblio=cr.biblio %] [% cr.biblio.author | html %] [% ItemTypes.GetDescription( cr.item.itype ) | html %] - [% Branches.GetName( cr.item.holdingbranch ) | html %]
      [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => cr.item.location, opac => 1 ) | html %] + [% Branches.GetName( cr.item.holdingbranch ) | html %]
      + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => cr.item.location, opac => 1 ) | html %] [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode, opac => 1 ) | html %] [% cr.item.itemcallnumber | html %] [% cr.item.copynumber | html %] [% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %] [% cr.issue.date_due | $KohaDates as_due_date => 1 %] - [% IF ( cr.public_note ) %] + [% IF ( cr.public_note ) %] [% cr.public_note | $raw %] [% ELSIF ( cr.item.itemnotes ) %] [% cr.item.itemnotes | $raw %] [% END %] - [% IF (cr.item.uri) %] + [% IF (cr.item.uri) %] Item URI [% ELSIF (cr.biblioitem.url) %] Record URL @@ -105,11 +108,16 @@

      No reserves have been selected for this research table.

[% END %] -
-
-
- - + + + + + + + + + + [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] [% INCLUDE 'datatables.inc' %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt index a20e67612b8..57c336e527c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-thesis-tables.tt @@ -5,7 +5,7 @@ [% USE TablesSettings %] [% INCLUDE 'doc-head-open.inc' %] -[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Research tables +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › [% course_type_display | html %] [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %] [% Asset.css("css/datatables.css") | $raw %] @@ -22,7 +22,7 @@ Home @@ -31,7 +31,7 @@
-

Research tables

+

[% course_type_display | html %]

@@ -46,22 +46,30 @@ [% FOREACH c IN courses %] - + + [% END %]
[% c.course_name | html %][%- IF c.section -%] - [% c.section | html %][%- END -%][% c.course_name | html %][%- IF c.section -%]- [% c.section | html %][%- END -%] [% c.course_number | html %] - [% FOREACH i IN c.instructors %] -
[% i.surname | html %][% IF i.firstname %], [% i.firstname | html %][% END %]
- [% END %] + [% FOREACH i IN c.instructors %] +
[% i.surname | html %][% IF i.firstname %], [% i.firstname | html %][% END %]
+ [% END %]
[% c.public_note | $raw %]
-
-
-
- - + + + + + + + + + + [% INCLUDE 'opac-bottom.inc' %] [% BLOCK jsinclude %] [% INCLUDE 'datatables.inc' %] diff --git a/opac/opac-thesis-table-details.pl b/opac/opac-thesis-table-details.pl index 07b69c6e3ca..bda4a673c45 100755 --- a/opac/opac-thesis-table-details.pl +++ b/opac/opac-thesis-table-details.pl @@ -24,6 +24,7 @@ use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); +use C4::Context; use C4::Koha; use C4::CourseReserves qw(GetCourse GetCourseReserves); @@ -47,9 +48,17 @@ die("No table_id given") unless ($table_id); my $course = GetCourse($table_id); my $course_reserves = GetCourseReserves( course_id => $table_id, include_items => 1, include_count => 1 ); +# Get the display text for this course type from authorized values +my $dbh = C4::Context->dbh; +my $course_type = $course->{course_type} || 'RESEARCH_TABLE'; +my $sth = $dbh->prepare("SELECT lib_opac FROM authorised_values WHERE category='CR_TYPE' AND authorised_value=?"); +$sth->execute($course_type); +my $display_name = $sth->fetchrow_array() || 'Research table'; + $template->param( - course => $course, - course_reserves => $course_reserves, + course => $course, + course_reserves => $course_reserves, + course_type_display => $display_name, ); output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/opac/opac-thesis-tables.pl b/opac/opac-thesis-tables.pl index e9a044bd0f6..32c975c1dc2 100755 --- a/opac/opac-thesis-tables.pl +++ b/opac/opac-thesis-tables.pl @@ -39,7 +39,17 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); -my $courses = SearchCourses( enabled => 'yes', thesis_table => 'yes' ); - -$template->param( courses => $courses ); +my $courses = SearchCourses( enabled => 'yes', course_type => 'RESEARCH_TABLE' ); + +# Get the display text for this course type from authorized values +my $dbh = C4::Context->dbh; +my $sth = $dbh->prepare( + "SELECT lib_opac FROM authorised_values WHERE category='CR_TYPE' AND authorised_value='RESEARCH_TABLE'"); +$sth->execute(); +my $display_name = $sth->fetchrow_array() || 'Research tables'; + +$template->param( + courses => $courses, + course_type_display => $display_name, +); output_html_with_http_headers $cgi, $cookie, $template->output; -- 2.53.0