Bug 42654: Restore section in OPAC course reserve detail title, breadcrumb and heading

When a course reserve has a section defined, the OPAC course detail page
should display it alongside the course name in the page title, breadcrumb,
and main heading. A previous change inadvertently removed this, leaving only
the course name in all three places.

This patch restores the conditional logic so that:
- If a section is set, the format "Course reserves for 'Course name' - Section"
  is used in the title, breadcrumb and <h1>.
- If no section is set, the existing "Course reserves for 'Course name'"
  format is preserved.

Test plan:
1. Enable the CourseReserves system preference.
2. In the staff interface, go to Course Reserves and create (or edit) a course
   that has a 'Section' value filled in (e.g. "Section A").
3. Add at least one item to that course reserve.
4. In the OPAC, browse to Course Reserves and click through to the detail
   page for that course.
5. Confirm that the browser tab title, the breadcrumb trail, and the page
   heading all show "Course reserves for '<course name>' - <section>".
6. Edit the course and clear the Section field.
7. Revisit the detail page and confirm that all three locations now show
   only "Course reserves for '<course name>'" with no trailing dash or
   section fragment.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@gmail.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2026-05-20 16:01:35 +01:00 committed by Lucas Gass
parent 7385ac8eae
commit 29ac3a0b5e
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 5 additions and 3 deletions

View File

@ -12,7 +12,7 @@
[% INCLUDE 'doc-head-open.inc' %]
<title
>[% FILTER collapse %]
[% tx("Course reserves for '{course_name}'", { course_name = course.course_name }) | html %]
[%- IF course.section -%][% tx("Course reserves for '{course_name}' - {section}", { course_name = course.course_name, section = course.section }) | html %][%- ELSE -%][% tx("Course reserves for '{course_name}'", { course_name = course.course_name }) | html %][%- END -%]
&rsaquo; [% PROCESS 'library_name_title' %]
[% END %]</title
>
@ -30,7 +30,7 @@
<a href="/cgi-bin/koha/opac-course-reserves.pl">Course reserves</a>
[% END %]
[% WRAPPER breadcrumb_item bc_active= 1 %]
[% tx("Course reserves for '{course_name}'", { course_name = course.course_name }) | html %]
[%- IF course.section -%][% tx("Course reserves for '{course_name}' - {section}", { course_name = course.course_name, section = course.section }) | html %][%- ELSE -%][% tx("Course reserves for '{course_name}'", { course_name = course.course_name }) | html %][%- END -%]
[% END %]
[% END #/ WRAPPER breadcrumbs %]
@ -38,7 +38,9 @@
<div class="row">
<div class="col">
<div id="course_reserves" class="maincontent">
<h1>[% tx("Course reserves for '{course_name}'", { course_name = course.course_name }) | html %]</h1>
<h1
>[%- IF course.section -%][% tx("Course reserves for '{course_name}' - {section}", { course_name = course.course_name, section = course.section }) | html %][%- ELSE -%][% tx("Course reserves for '{course_name}'", { course_name = course.course_name }) | html %][%- END -%]</h1
>
<div class="rows">
<ol>
[% IF ( course.term ) %]<li><span class="label">[% tp('Semester', 'Term:') | html %]</span> [% AuthorisedValues.GetByCode( 'TERM', course.term, 1 ) | html %]</li>[% END %]