Changeset 27160

Show
Ignore:
Timestamp:
08.04.2013 19:29:39 (7 years ago)
Author:
ak19
Message:

Committing bugfix discovered during restructuring of code (the restructured code is still being tested). Previously, the remove_archives_meta subroutine was ignoring any metavalue that was provided (and was instead always deleting the first metavalue for a metaname, unless metapos was explicitly set), whereas the rfdxml_metadata parse function clearly contained code to handle deleting a specified metavalue. Now remove_archives_meta checks for metapos and metavalue, and if both/either is set the specified value(s) are deleted. If neither is set, then metapos defaults to 0 as in the past and the first metavalue for the given metaname is deleted.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm

    r27157 r27160  
    14551455    my $metaname = $self->{'metaname'}; 
    14561456    my $metapos = $self->{'metapos'}; 
    1457     $metapos = 0 if (!defined $metapos); 
     1457    my $metavalue = $self->{'metavalue'} || undef; # necessary to force fallback to undef here 
     1458 
     1459    # if the user hasn't told us what to delete, not having given a metavalue or metapos, 
     1460    # default to deleting the first metavalue for the given metaname 
     1461    # Beware that if both metapos AND metavalue are defined, both matches (if any)  
     1462    # seem to get deleted in one single remove_archives_meta action invocation. 
     1463    # Similarly, if 2 identical metavalues for a metaname exist and that metavalue is being 
     1464    # deleted, both get deleted. 
     1465    if(!defined $metapos && !defined $metavalue) { 
     1466        $metapos = 0; 
     1467    } 
    14581468     
    14591469    my $arcinfo_doc_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archive_dir); 
     
    14631473    my $doc_filename = $doc_rec->{'doc-file'}->[0];  
    14641474 
    1465     my $status = $self->remove_from_doc_xml($gsdl_cgi, &util::filename_cat($archive_dir, $doc_filename), $metaname, $metapos, undef, $docid_secnum); 
     1475    my $status = $self->remove_from_doc_xml($gsdl_cgi, &util::filename_cat($archive_dir, $doc_filename), $metaname, $metapos, $metavalue, $docid_secnum); 
     1476#   my $status = $self->remove_from_doc_xml($gsdl_cgi, &util::filename_cat($archive_dir, $doc_filename), $metaname, $metapos, undef, $docid_secnum); 
    14661477     
    14671478    if ($status == 0)