diff --git a/batch_uploads_imageuploader b/batch_uploads_imageuploader index 5182eb7c3..3405515be 100755 --- a/batch_uploads_imageuploader +++ b/batch_uploads_imageuploader @@ -7,7 +7,7 @@ use Getopt::Tabular; use NeuroDB::DBI; use NeuroDB::Notify; -my $profile = undef; +my $profile = ''; my $upload_id = undef; my $fullpath = undef; my $phantom = undef; @@ -25,6 +25,30 @@ my @opt_table = ( ["-verbose", "boolean", 1, \$verbose, "Be verbose."] ); +my $Help = <log_batch_imageuploader.txt 2>&1 [options] + $0 -help to list options +USAGE +&Getopt::Tabular::SetHelp( $Help, $Usage ); &Getopt::Tabular::GetOptions( \@opt_table, \@ARGV ) || exit 1; ################################################################ @@ -38,6 +62,12 @@ if ( $profile && !@Settings::db ) { exit 2; } +if (!$profile ) { + print $Help; + print "\n$Usage\n"; + exit 3; +} + ################################################################ ################ Establish database connection ################# ################################################################ @@ -111,10 +141,10 @@ foreach my $input (@resultsarray) exit(4); } if ($phantom eq 'N') { - if ($base ne $patientname) { + if ($patientname ne (substr ($base, 0, length($patientname)))) { print "Make sure the patient name $patientname " . - "for non-phantom entries matches the file " . - "name $base in $path\n"; + "for non-phantom entries matches the start of the ". + "filename $base in $path\n"; exit(5); } }