Bug 20638: (follow-up) Silence viewlog.pl warning

This patch fixes useless warnings being printed by `viewlog.pl` I
noticed while testing this new feature.

To test:
1. Test the feature introduced by this patchset
2. Make sure you are running:
   $ ktd --shell
  k$ tail -f /var/log/koha/kohadev/*.log
=> FAIL: You see things like:

```
[2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
[2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
[2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
[2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
[2025/09/26 18:37:39] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
[2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
[2025/09/26 18:43:44] [WARN] Use of uninitialized value in substr at /kohadevbox/koha/tools/viewlog.pl line 156.
```
3. Refresh the viewlog page
=> FAIL: They are consistent
4. Apply this patch
5. Repeat 3
=> SUCCESS: No more warnings!
6. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2025-09-26 15:45:14 -03:00 committed by Lucas Gass
parent 130ee49ba4
commit 95ce864450
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ if ($do_it) {
$result->{'biblioitemnumber'} = q{};
$result->{'barcode'} = q{};
if ( substr( $log->info, 0, 4 ) eq 'item' ) {
if ( defined $log->info && substr( $log->info, 0, 4 ) eq 'item' ) {
# get item information so we can create a working link
my $itemnumber = $log->object;