Bug 26311: (follow-up) Fix undefined values in sprintf
authorFridolin Somers <fridolin.somers@biblibre.com>
Tue, 28 Jun 2022 06:08:33 +0000 (20:08 -1000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 5 Jul 2022 12:20:51 +0000 (09:20 -0300)
Avoid warns 'Use of uninitialized value in sprintf' by using
'0' if lower age is undefined
'unlimited' if upper are is undefined

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
misc/maintenance/search_for_data_inconsistencies.pl

index f76b66f..38bc5f6 100755 (executable)
@@ -302,9 +302,9 @@ use C4::Biblio qw( GetMarcFromKohaField );
         foreach my $invalid_patron (@invalid_patrons) {
             my $category = $invalid_patron->category;
             new_item(
-                sprintf "Patron borrowernumber=%s has an invalid age of %s for their category '%s' (%s-%s)",
+                sprintf "Patron borrowernumber=%s has an invalid age of %s for their category '%s' (%s to %s)",
                 $invalid_patron->borrowernumber, $invalid_patron->get_age, $category->categorycode,
-                $category->dateofbirthrequired,  $category->upperagelimit
+                $category->dateofbirthrequired // '0',  $category->upperagelimit // 'unlimited'
             );
         }
         new_hint("You may change the patron's category automatically with misc/cronjobs/update_patrons_category.pl");