Index: /main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm
===================================================================
--- /main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm	(revision 28158)
+++ /main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm	(revision 28159)
@@ -1,3 +1,3 @@
-###########################################################################
+##########################################################################
 #
 # metadataaction.pm -- 
@@ -1064,4 +1064,5 @@
 sub set_index_metadata_entry
 {
+    print STDERR "1\n";
     my $self = shift @_;
     my ($collect_dir,$collect,$infodbtype,$docid,$metaname,$metapos,$metavalue,$metamode,$prevmetavalue) = @_;
@@ -1074,4 +1075,5 @@
     my $infodb_file_path = &dbutil::get_infodb_file_path($infodbtype, $collect_tail, $index_text_directory);
 	
+    print STDERR "2\n";
 #	print STDERR "**** infodb file path = $infodb_file_path\n";
 #	print STDERR "***** infodb type = $infodbtype\n";
@@ -1082,4 +1084,5 @@
     # Set the metadata value
     if (defined $metapos) {
+    print STDERR "3\n";
 	# if metamode=accumulate AND metapos, warn user and then use metapos
 	if (defined $metamode && $metamode eq "accumulate") {
@@ -1090,4 +1093,5 @@
     }
     elsif (defined $prevmetavalue) {
+    print STDERR "4\n";
 		my $array = $doc_rec->{$metaname};
         my $length = @$array;
@@ -1107,8 +1111,10 @@
     }
     elsif (defined $metamode && $metamode eq "override") {
+    print STDERR "5\n";
 	$doc_rec->{$metaname} = [ $metavalue ];	
     }
     else { # default for index was to override, but because accumulate is less destructive, 
 	# and because accumulate is the default for archives and import, that's the new default for index too
+    print STDERR "6\n";
 	if(defined $doc_rec->{$metaname}) {
 	    push(@{$doc_rec->{$metaname}}, $metavalue); # accumulate the value for that metaname
@@ -1117,4 +1123,5 @@
 	}
     }
+    print STDERR "6\n";
  
     my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path,$docid,$doc_rec);
@@ -1249,4 +1256,5 @@
 sub _set_index_metadata
 {
+    print STDERR "START SET INDEX METADATA\n";
     my $self = shift @_;
 
@@ -1266,6 +1274,7 @@
     my $prevmetavalue = $self->{'prevmetavalue'};
 
+    print STDERR "SETTING INDEX METADATA ENTRY\n";
 	my $status = $self->set_index_metadata_entry($collect_dir,$collect,$infodbtype,$docid,$metaname,$metapos,$metavalue,$metamode,$prevmetavalue);
-	
+    print STDERR "DONE SETTING INDEX METADATA ENTRY\n";
     if ($status != 0) {
         # Catch error if set infodb entry failed
@@ -1287,4 +1296,5 @@
     }
 
+    print STDERR "END SET INDEX METADATA\n";
     #return $status; # in case calling functions have any further use for this
 }
@@ -1920,13 +1930,15 @@
   edit_doc_xml()
 ****************************
-doc_xml_filename = $doc_xml_filename
-metaname = $metaname
-metavalue = $metavalue
-metapos = $metapos
-metamode = $metamode
-opt_secnum = $opt_secnum
-prevmetavalue = $prevmetavalue
-****************************
 RAWEND
+
+    $info_mess .= " doc_xml_filename = $doc_xml_filename\n" if defined($doc_xml_filename);
+    $info_mess .= " metaname    = $metaname\n"    if defined($metaname);
+    $info_mess .= " metapos     = $metapos\n"     if defined($metapos);
+    $info_mess .= " metavalue   = $metavalue\n"   if defined($metavalue);
+    $info_mess .= " metamode    = $metamode\n"    if defined($metamode);
+    $info_mess .= " opt_secnum  = $opt_secnum\n"  if defined($opt_secnum);
+    $info_mess .= " prevmetaval = $prevmetavalue\n" if defined($prevmetavalue);
+     
+    $info_mess .= "****************************\n";
 
     $gsdl_cgi->generate_message($info_mess);
@@ -1960,23 +1972,25 @@
 sub set_archives_metadata_entry
 {
-  	my $self = shift @_;
-	my ($gsdl_cgi, $archive_dir, $collect_dir, $collect, $infodbtype, $docid, $metaname, $metapos, $metavalue, $metamode, $prevmetavalue) = @_;
-	
-	my $info_mess = <<RAWEND;
+    my $self = shift @_;
+    my ($gsdl_cgi, $archive_dir, $collect_dir, $collect, $infodbtype, $docid, $metaname, $metapos, $metavalue, $metamode, $prevmetavalue) = @_;
+
+    my $info_mess = <<RAWEND;
 ****************************
   set_archives_metadata_entry()
 ****************************
-archive_dir = $archive_dir
-collect_dir = $collect_dir
-collect = $collect
-infodbtype = $infodbtype
-docid = $docid
-metaname = $metaname
-metapos = $metapos
-metavalue = $metavalue
-metamode = $metamode
-prevmetavalue = $prevmetavalue
-****************************
 RAWEND
+
+    $info_mess .= " archive_dir = $archive_dir\n" if defined($archive_dir);
+    $info_mess .= " collect_dir = $collect_dir\n" if defined($collect_dir);
+    $info_mess .= " collect     = $collect\n"     if defined($collect);
+    $info_mess .= " infodbtype  = $infodbtype\n"  if defined($infodbtype);
+    $info_mess .= " docid       = $docid\n"       if defined($docid);
+    $info_mess .= " metaname    = $metaname\n"    if defined($metaname);
+    $info_mess .= " metapos     = $metapos\n"     if defined($metapos);
+    $info_mess .= " metavalue   = $metavalue\n"   if defined($metavalue);
+    $info_mess .= " metamode    = $metamode\n"    if defined($metamode);
+    $info_mess .= " prevmetaval = $prevmetavalue\n" if defined($prevmetavalue);
+     
+    $info_mess .= "****************************\n";
 
     $gsdl_cgi->generate_message($info_mess);
@@ -2542,5 +2556,5 @@
 	};
 	my $append_metadata = [ "Metadata" => $metadata_attr ];
-	my $description_attr->{'_content'} = [ "\n\t\t   ", $append_metadata, "\n\t\t"];
+	my $description_attr = { '_content' => [ "\n\t\t   ", $append_metadata, "\n\t\t"] };
 	my $description_element = [ "Description" => $description_attr ];
 
@@ -2822,16 +2836,18 @@
   set_import_metadata_entry()
 ****************************
-collect = $collect
-collect_dir = $collect_dir
-infodbtype = $infodbtype
-arcinfo_doc_filename = $arcinfo_doc_filename
-docid = $docid
-metaname = $metaname
-metapos = $metapos
-metavalue = $metavalue
-metamode = $metamode
-prevmetavalue = $prevmetavalue
-****************************
 RAWEND
+
+    $info_mess .= " collect_dir = $collect_dir\n" if defined($collect_dir);
+    $info_mess .= " collect     = $collect\n"     if defined($collect);
+    $info_mess .= " infodbtype  = $infodbtype\n"  if defined($infodbtype);
+    $info_mess .= " arcinfo_doc_filename  = $arcinfo_doc_filename\n"  if defined($arcinfo_doc_filename);
+    $info_mess .= " docid       = $docid\n"       if defined($docid);
+    $info_mess .= " metaname    = $metaname\n"    if defined($metaname);
+    $info_mess .= " metapos     = $metapos\n"     if defined($metapos);
+    $info_mess .= " metavalue   = $metavalue\n"   if defined($metavalue);
+    $info_mess .= " metamode    = $metamode\n"    if defined($metamode);
+    $info_mess .= " prevmetaval = $prevmetavalue\n" if defined($prevmetavalue);
+     
+    $info_mess .= "****************************\n";
 
     $gsdl_cgi->generate_message($info_mess);
