From c0b92a6a30876d5f68dc86b1022ca297a3989c68 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Jun 2023 09:48:42 +0200 Subject: [PATCH] Bug 33946: Do not display link to non-existing bibliographic record If you use biblio-title.inc on a biblio that does not longer exist, "No title" is shown with a link to catalogue/detail?.pl?biblionumber= We should at least remove the link. We could even do better and display "No bibliographic record" if the biblio does not longer exist. Test plan: Edit mainpage.pl, add $template->param( your_bib => Koha::Biblios->find(42) ); Edit intranet-main.tt, add [% INCLUDE 'biblio-title.inc' biblio=your_bib link = 1 %] Not hit the main page and see what's hapenning. If you have a bibliographic record with biblionumber=42, its info will be displayed. Remove this record and try again => it's replaced with "No bibliographic record" without a link Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit f3e0abddffb8927a48dcf798f8934b5565a9b3b4) Signed-off-by: Martin Renvoize (cherry picked from commit b1ae28e5009824212bcb37073047ceb4bf754dc1) Signed-off-by: Matt Blenkinsop --- .../prog/en/includes/biblio-title.inc | 53 ++++++++++--------- .../bootstrap/en/includes/biblio-title.inc | 11 ++-- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc index 2e7ca6426a..de6fada74d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc @@ -1,30 +1,33 @@ -[% IF ( link ) %] - -[% END %] +[%- IF link && ! biblio %][% link = 0 %][% END %] +[%- IF ( link ) -%] + +[%- END -%] -[% IF ( biblio.title ) %] +[%- IF !biblio -%] + No bibliographic record +[%- ELSIF !biblio.title -%] + No title +[%- ELSE -%] [% biblio.title | html %] -[% ELSE %] - No title -[% END %] -[% IF ( biblio.medium ) %] - [% biblio.medium | html %] -[% END %] -[% FOREACH subtitle IN biblio.subtitle.split(' \\| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] - [% subtitle | html %] -[% END %] -[% part_numbers = biblio.part_number.split(' \\| ') %] -[% part_names = biblio.part_name.split(' \\| ') %] -[% i = 0 %] -[% WHILE ( part_numbers.$i.defined || part_names.$i.defined ) %] - [% IF ( part_numbers.$i.defined ) %] - [% part_numbers.$i | html %] - [% END %] - [% IF ( part_names.$i.defined ) %] - [% part_names.$i | html %] - [% END %] - [% i = i + 1 %] -[% END %] +[%- END -%] +[%- IF ( biblio.medium ) -%] + [%- biblio.medium | html -%] +[%- END -%] +[%- FOREACH subtitle IN biblio.subtitle.split(' \\| ') -%][%- IF Koha.Preference('marcflavour')=='UNIMARC' -%],[%- END -%] + [%- subtitle | html -%] +[%- END -%] +[%- part_numbers = biblio.part_number.split(' \\| ') -%] +[%- part_names = biblio.part_name.split(' \\| ') -%] +[%- i = 0 -%] +[%- WHILE ( part_numbers.$i.defined || part_names.$i.defined ) -%] + [%- IF ( part_numbers.$i.defined ) -%] + [%- part_numbers.$i | html -%] + [%- END -%] + [%- IF ( part_names.$i.defined ) -%] + [%- part_names.$i | html -%] + [%- END -%] + [%- i = i + 1 -%] +[%- END -%] [% IF ( link ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title.inc index bc8d70e0e9..d3bbf53917 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title.inc @@ -1,12 +1,15 @@ +[%- IF link && ! biblio %][% link = 0 %][% END %] [% IF ( link ) %] [% END %] -[% IF ( biblio.title ) %] - [% biblio.title | html %] -[% ELSE %] +[%- IF !biblio -%] + No bibliographic record +[%- ELSIF !biblio.title -%] No title -[% END %] +[%- ELSE -%] + [% biblio.title | html %] +[%- END -%] [% FOREACH subtitle IN biblio.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitle | html %] [% END %] -- 2.39.2