Bugzilla – Attachment 192860 Details for
Bug 35972
Add a 'Research tables' feature, that builds upon Course reserves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35972: Implement dynamic course type display in OPAC
fdf1e66.patch (text/plain), 15.12 KB, created by
Martin Renvoize (ashimema)
on 2026-02-10 11:29:23 UTC
(
hide
)
Description:
Bug 35972: Implement dynamic course type display in OPAC
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-10 11:29:23 UTC
Size:
15.12 KB
patch
obsolete
>From fdf1e6639bae55eae64b52759118776c8f1bb49d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >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 @@ > <li class="nav-item"> > <a href="/cgi-bin/koha/opac-course-reserves.pl">Course reserves</a> > </li> >+ <li class="nav-item"> >+ <a href="/cgi-bin/koha/opac-thesis-tables.pl">Research tables</a> >+ </li> > [% END %] > [% IF Koha.Preference( 'OpacBrowser' ) == 1 %] > <li class="nav-item"> >@@ -431,9 +434,6 @@ > <li class="nav-item"> > <a href="/cgi-bin/koha/opac-suggestions.pl?suggested_by_anyone=1">Purchase suggestions</a> > </li> >- <li class="nav-item"> >- <a href="/cgi-bin/koha/opac-thesis-tables.pl">Research tables</a> >- </li> > [% 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' %] >-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Reserves for [% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]</title> >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Reserves for [% course.course_name | html %][%- IF course.section -%]- [% course.section | html %][%- END -%]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% BLOCK cssinclude %] > [% Asset.css("css/datatables.css") | $raw %] >@@ -24,11 +24,9 @@ > <a href="/cgi-bin/koha/opac-main.pl">Home</a> > </li> > <li class="breadcrumb-item"> >- <a href="/cgi-bin/koha/opac-thesis-tables.pl">Research tables</a> >- </li> >- <li class="breadcrumb-item" aria-current="page"> >- Reserves for <em>[% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]</em> >+ <a href="/cgi-bin/koha/opac-thesis-tables.pl">[% course_type_display | html %]</a> > </li> >+ <li class="breadcrumb-item" aria-current="page"> Reserves for <em>[% course.course_name | html %][%- IF course.section -%]- [% course.section | html %][%- END -%]</em> </li> > </ul> > </nav> > >@@ -36,12 +34,12 @@ > <div class="row"> > <div class="col"> > <div id="thesis_tables" class="maincontent"> >- >- <h2>Reserves for <em>[% course.course_name | html %][%- IF course.section -%] - [% course.section | html %][%- END -%]</em></h2> >+ <h2>Reserves for <em>[% course.course_name | html %][%- IF course.section -%]- [% course.section | html %][%- END -%]</em></h2> > <div class="rows"> > <ol> > [% IF ( course.instructors ) %] >- <li><span class="label">Researcher:</span> >+ <li >+ ><span class="label">Researcher:</span> > <ul> > [% FOREACH i IN course.instructors %] > <li><div class="instructor">[% i.firstname | html %] [% i.surname | html %]</div></li> >@@ -77,19 +75,24 @@ > <td><a href="opac-detail.pl?biblionumber=[% cr.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title-head.inc' biblio=cr.biblio %]</a></td> > <td>[% cr.biblio.author | html %]</td> > <td>[% ItemTypes.GetDescription( cr.item.itype ) | html %]</td> >- <td>[% Branches.GetName( cr.item.holdingbranch ) | html %] <br/> <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => cr.item.location, opac => 1 ) | html %]</em></td> >+ <td >+ >[% Branches.GetName( cr.item.holdingbranch ) | html %] <br /> >+ <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => cr.item.location, opac => 1 ) | html %]</em></td >+ > > <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode, opac => 1 ) | html %]</td> > <td>[% cr.item.itemcallnumber | html %]</td> > <td>[% cr.item.copynumber | html %]</td> > <td>[% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %]</td> > <td><span title="[% cr.issue.date_due | html %]">[% cr.issue.date_due | $KohaDates as_due_date => 1 %]</span></td> >- <td>[% IF ( cr.public_note ) %] >+ <td >+ >[% IF ( cr.public_note ) %] > [% cr.public_note | $raw %] > [% ELSIF ( cr.item.itemnotes ) %] > [% cr.item.itemnotes | $raw %] > [% END %] > </td> >- <td>[% IF (cr.item.uri) %] >+ <td >+ >[% IF (cr.item.uri) %] > <a href="[% cr.item.uri | url %]">Item URI</a> > [% ELSIF (cr.biblioitem.url) %] > <a href="[% cr.biblioitem.url | url %]">Record URL</a> >@@ -105,11 +108,16 @@ > <p>No reserves have been selected for this research table.</p> > </div> > [% END %] >- </div> <!-- / #course_reserves --> >- </div> <!-- / .col --> >- </div> <!-- / .row --> >- </div> <!-- / .container-fluid --> >-</div> <!-- / .main --> >+ </div> >+ <!-- / #course_reserves --> >+ </div> >+ <!-- / .col --> >+ </div> >+ <!-- / .row --> >+ </div> >+ <!-- / .container-fluid --> >+</div> >+<!-- / .main --> > [% 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' %] >-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Research tables</title> >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › [% course_type_display | html %]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% BLOCK cssinclude %] > [% Asset.css("css/datatables.css") | $raw %] >@@ -22,7 +22,7 @@ > <a href="/cgi-bin/koha/opac-main.pl">Home</a> > </li> > <li class="breadcrumb-item" aria-current="page"> >- <a href="#">Research tables</a> >+ <a href="#">[% course_type_display | html %]</a> > </li> > </ul> > </nav> >@@ -31,7 +31,7 @@ > <div class="row"> > <div class="col order-first order-md-first order-lg-2"> > <div id="courses" class="maincontent"> >- <h1>Research tables</h1> >+ <h1>[% course_type_display | html %]</h1> > > <table id="thesis_tables_table" class="table table-bordered table-striped table-condensed"> > <thead> >@@ -46,22 +46,30 @@ > <tbody> > [% FOREACH c IN courses %] > <tr> >- <td><a href="opac-thesis-table-details.pl?table_id=[% c.course_id | uri %]">[% c.course_name | html %][%- IF c.section -%] - [% c.section | html %][%- END -%]</a></td> >+ <td><a href="opac-thesis-table-details.pl?table_id=[% c.course_id | uri %]">[% c.course_name | html %][%- IF c.section -%]- [% c.section | html %][%- END -%]</a></td> > <td>[% c.course_number | html %]</td> > <td> >- [% FOREACH i IN c.instructors %] >- <div class="instructor"><span class="inst_surname">[% i.surname | html %]</span>[% IF i.firstname %]<span class="instr_separator">, </span><span class="instr_firstname">[% i.firstname | html %]</span>[% END %]</div> >- [% END %] >+ [% FOREACH i IN c.instructors %] >+ <div class="instructor" >+ ><span class="inst_surname">[% i.surname | html %]</span>[% IF i.firstname %]<span class="instr_separator">, </span><span class="instr_firstname">[% i.firstname | html %]</span>[% END %]</div >+ > >+ [% END %] > </td> > <td>[% c.public_note | $raw %]</td> >+ </tr> > [% END %] > </tbody> > </table> >- </div> <!-- / #courses --> >- </div> <!-- / .col --> >- </div> <!-- / .row --> >- </div> <!-- / .container-fluid --> >-</div> <!-- / .main --> >+ </div> >+ <!-- / #courses --> >+ </div> >+ <!-- / .col --> >+ </div> >+ <!-- / .row --> >+ </div> >+ <!-- / .container-fluid --> >+</div> >+<!-- / .main --> > [% 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 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35972
:
161714
|
161802
|
161803
|
192856
|
192857
|
192858
|
192859
| 192860 |
192861