From 57b0cc2e1f14e0492ee7d709faaae2f334c1f1b3 Mon Sep 17 00:00:00 2001
From: Jens Steidl <Jens.Steidl@slub-dresden.de>
Date: Wed, 14 Oct 2020 17:58:45 +0200
Subject: [PATCH] - added warning / user hint about missing title

---
 bin/slubsipbuilderbagit.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bin/slubsipbuilderbagit.pl b/bin/slubsipbuilderbagit.pl
index ba427d3..8122a79 100644
--- a/bin/slubsipbuilderbagit.pl
+++ b/bin/slubsipbuilderbagit.pl
@@ -587,6 +587,7 @@ use Getopt::Long;
 use Path::Tiny;
 use Carp;                     # confess()
 use Pod::Usage;               # pod2usage()
+use List::Util qw(none);
 
 my $save;
 my $ieDirectory;
@@ -766,6 +767,14 @@ sub main{
     # get bag name
     my $bagNameDir = SLUB::LZA::SIPBuilderBagIt::generateBagName($exportToArchiveDate, $ppn, $noppn);
 
+    # user hints
+    my @keys;
+    for my $hash (@addBagInfo) {
+        push @keys, keys %{$hash};
+    }
+    SLUB::LZA::SIPBuilderBagIt::print_scalar_data("", "WARNING: No Title given. Please consider adding a human-readable title with '--add_key_value=Title:YOUR-TITLE'", "", "yellow")
+        if none { $_ =~ m/^[Tt][Ii][Tt][Ll][Ee]/ } @keys;
+
     # save options
     if($save eq "copy") {
         my $bagPath = "$outputPath/$bagNameDir";
-- 
GitLab