Description: Fix, lexical.pm last_use_label ignores "storage" field on tapelist
Author: Jean-Louis Martineau <JMartineau@carbonite.com>

Index: amanda.git/perl/Amanda/Taper/Scan/lexical.pm
===================================================================
--- amanda.git.orig/perl/Amanda/Taper/Scan/lexical.pm	2024-07-24 12:31:41.050764670 +0100
+++ amanda.git/perl/Amanda/Taper/Scan/lexical.pm	2024-07-24 12:31:41.046764659 +0100
@@ -85,6 +85,22 @@ sub last_use_label_from_pool {
     return undef;
 }
 
+sub last_use_label_from_pool {
+    my $self = shift;
+
+    my $tles = $self->{'tapelist'}->{tles};
+    my $count = @{$tles};
+    for (my $i = 0; $i < $count ; $i++) {
+	my $tle = $tles->[$i];
+	if ($tle->{'datestamp'} != '0' &&
+	    (!defined $tle->{'pool'} ||
+	      $tle->{'pool'} eq $self->{'tapepool'})) {
+	    return $tle->{'label'};
+	}
+    }
+    return undef;
+}
+
 sub analyze {
     my $self = shift;
     my $inventory  = shift;
