From dd30878d6a74329f18975a335ed7bd4f30507176 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 28 Oct 2022 14:43:10 +0000 Subject: [PATCH] Bug 32037: Check for existence of object before building link This patch adds a check on the existence of the object and passes this to the template I also drop a level of IF by moving to ELSIF To test: 1 - Enable ReturnLog amd IssueLog 2 - Checkout an item to a patron 3 - Return it 4 - View 'Modification log' tab of the borrwer 5 - Note item links, test them, they work 6 - Delete the item 7 - Reload and try links again, they do not work 8 - Apply patch 9 - Reload, no more links 10 - Checkout and return another item 11 - This one has links, and they work as before Signed-off-by: David Nind --- .../prog/en/modules/tools/viewlog.tt | 30 +++++++++---------- tools/viewlog.pl | 1 + 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index ac37c1996d..9bf9f915e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -391,24 +391,22 @@ [% END %] - [% IF ( loopro.module == 'CIRCULATION' ) %] + [% IF ( loopro.module == 'CIRCULATION' && loopro.object_found ) %] Item [% loopro.barcode | html %] + [% ELSIF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "NEWS" %] +
[% loopro.info | trim | html %]
+
+ +
+ [% ELSIF loopro.module == "NOTICES" %] +
[% loopro.info | trim | html %]
+
+ +
[% ELSE %] - [% IF loopro.module == "SYSTEMPREFERENCE" || loopro.module == "REPORTS" || loopro.module == "NEWS" %] -
[% loopro.info | trim | html %]
-
- -
- [% ELSIF loopro.module == "NOTICES" %] -
[% loopro.info | trim | html %]
-
- -
- [% ELSE %] -
- [% loopro.info | html %] -
- [% END %] +
+ [% loopro.info | html %] +
[% END %] [% PROCESS translate_log_interface log_interface=loopro.interface %] diff --git a/tools/viewlog.pl b/tools/viewlog.pl index 49eeb5decc..9db4e430ed 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -157,6 +157,7 @@ if ($do_it) { $itemnumber = $log->info if ( $log->module eq "CIRCULATION" ); my $item = Koha::Items->find($itemnumber); if ($item) { + $result->{'object_found'} = 1; $result->{'biblionumber'} = $item->biblionumber; $result->{'biblioitemnumber'} = $item->biblionumber; $result->{'barcode'} = $item->barcode; -- 2.30.2