Index: main/trunk/greenstone2/perllib/plugouts/MySQLPlugout.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugouts/MySQLPlugout.pm	(revision 32522)
+++ main/trunk/greenstone2/perllib/plugouts/MySQLPlugout.pm	(revision 32523)
@@ -136,8 +136,6 @@
     # won't bother preparing GreenstoneXMLPlugout by calling superclass' begin()
     # finally, can call begin on super - important as doc.xml is opened as a group etc
-
-    if($proc_mode ne "all") { # TODO Q
-	$self->GreenstoneXMLPlugout::begin(@_);
-    }
+    
+    $self->GreenstoneXMLPlugout::begin(@_);
 }
 
@@ -148,19 +146,9 @@
 
     # do the superclass stuff first, as any sql db failures should not prevent superclass cleanup
-    
-    if($self->{'process_mode'} ne "all") {# TODO Q
-	$self->GreenstoneXMLPlugout::end(@_);
-    }
+    $self->GreenstoneXMLPlugout::end(@_);    
     
     $self->disconnect_from_db() || warn("Unable to disconnect from database " . $self->{'site_name'} . "\n"); # disconnect_from_db() will also issue a warning, but this may be clearer
 }
  
-sub close_group_output {
-    my $self = shift (@_);
-    
-    if($self->{'process_mode'} ne "all") { # TODO Q
-	$self->GreenstoneXMLPlugout::close_group_output();
-    }
-}
    
 # TODO: check arc-inf.db for whether each entry is to be deleted/indexed/reindexed/been indexed
@@ -172,36 +160,34 @@
     
     # 1. pre save out and saving debug handle
-    my ($docxml_outhandler, $output_file);
-    if($proc_mode ne "all") { # TODO Q
-	($docxml_outhandler, $output_file) = $self->GreenstoneXMLPlugout::pre_saveas(@_);
-
-	$self->{'debug_outhandle'} = $docxml_outhandler if ($self->{'debug'}); # STDOUT if debug
-    }
-    elsif ($self->{'debug'}) { # if we didn't call superclass::pre_saveas, then set debug handle
-	$self->{'debug_outhandle'} = STDOUT; # superclass also debugs to STDOUT
-	# TODO: also set debugging in begin()? Then stmts creating db and tables also sent to debug out and not executed
-    }
+
+    # must call superclass (pre/post) saveas methods, as they handle assoc_files too
+    my ($docxml_outhandler, $output_file) = $self->GreenstoneXMLPlugout::pre_saveas(@_);
+
+    $self->{'debug_outhandle'} = $docxml_outhandler if ($self->{'debug'}); # STDOUT if debug
+
+    # TODO: also set debugging in begin()? Then stmts creating db and tables also sent to debug out and not executed
+
+    # TODO: remove unused old_unused_saveas from GreenstoneXMLPlugout
     
     
     # 2. overriding saving behaviour to do what the superclass does PLUS saving to sql db    
 
-    if($proc_mode ne "all" ) { # if all, then nothing to go into doc.xml, otherwise:
+    #NOTE: if proc_mode == all, then "breadcrumbs" go into both meta and txt elements of doc.xml:
+    # statements pointing viewer to the sql db for contents
 	
-	# write the INVERSE into doc.xml as to what is written to the db
-	
-	my $docxml_output_options = { 'output' => docprint::OUTPUT_NONE }; # TODO Q
-	
-	if($proc_mode eq "meta_only" ) { # since only meta to go into MySQL db, text will go into docxml
-	    $docxml_output_options->{'output'} = docprint::OUTPUT_TEXT_ONLY;
-	} elsif($proc_mode eq "text_only" ) { # since only full text to go into MySQL db, meta will go into docxml
-	    $docxml_output_options->{'output'} = docprint::OUTPUT_META_ONLY;
-	}
-
-	# now we've prepared to write out whatever is meant to go into docxml
-	# and can do actual the steps superclass GreenstoneXMLPlugout carries out to write out docxml
-	# So: write out the doc xml file for the current document
-	my $section_text = &docprint::get_section_xml($doc_obj, $docxml_output_options);
-	print $docxml_outhandler $section_text;    
-    }
+    # write the INVERSE into doc.xml as to what is written to the db    
+    my $docxml_output_options = { 'output' => docprint::OUTPUT_NONE };
+    if($proc_mode eq "meta_only" ) { # since only meta to go into MySQL db, text will go into docxml
+	$docxml_output_options->{'output'} = docprint::OUTPUT_TEXT_ONLY;
+    } elsif($proc_mode eq "text_only" ) { # since only full text to go into MySQL db, meta will go into docxml
+	$docxml_output_options->{'output'} = docprint::OUTPUT_META_ONLY;
+    }
+    
+    # now we've prepared to write out whatever is meant to go into docxml
+    # and can do actual the steps superclass GreenstoneXMLPlugout carries out to write out docxml
+    # So: write out the doc xml file for the current document
+    my $section_text = &docprint::get_section_xml($doc_obj, $docxml_output_options);
+    print $docxml_outhandler $section_text;    
+    
     
     # We also write out whatever needs to go into the MySQL database
@@ -210,8 +196,7 @@
     
     # 3. post save out
-    if($proc_mode ne "all" ) { # TODO Q
-	#$self->GreenstoneXMLPlugout::post_saveas(@_);
-	$self->GreenstoneXMLPlugout::post_saveas($doc_obj, $doc_dir, $docxml_outhandler, $output_file);
-    }
+    #$self->GreenstoneXMLPlugout::post_saveas(@_);
+    $self->GreenstoneXMLPlugout::post_saveas($doc_obj, $doc_dir, $docxml_outhandler, $output_file);
+    
     
     # database connection is closed in end() method
