Changeset 27162

Show
Ignore:
Timestamp:
09.04.2013 18:58:07 (7 years ago)
Author:
ak19
Message:

Fixed bug in remove_index_metadata: it was specifically including the metavalue to be deleted in the metadata that was to be retained (the erroneous line was pushing metavalue instead of metaval onto filtered_metadata).

Files:
1 modified

Legend:

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

    r27160 r27162  
    22082208    my $metaname  = $self->{'metaname'}; 
    22092209    my $metapos   = $self->{'metapos'}; 
    2210     my $metavalue = $self->{'metavalue'}; 
     2210    my $metavalue = $self->{'metavalue'} || undef; # necessary to force fallback to undef here 
    22112211 
    22122212    # To people who know $collect_tail please add some comments 
     
    22442244 
    22452245    # Obtain the specified metadata pos 
    2246     $metapos = 0 if (!defined $metapos); 
     2246    if(!defined $metapos && !defined $metavalue) { #$metapos = 0 if (!defined $metapos); 
     2247        $metapos = 0; 
     2248    } 
    22472249 
    22482250    # consider check key is defined before deleting? 
     
    22542256 
    22552257    if (!defined $metavalue && $i != $metapos) { 
    2256         push(@$filtered_metadata,$metaval) 
     2258        push(@$filtered_metadata,$metaval); 
    22572259    } 
    22582260     
    22592261    if(defined $metavalue && !($metavalue eq $metaval)) 
    22602262    { 
    2261         push(@$filtered_metadata,$metavalue) 
     2263        push(@$filtered_metadata,$metaval); 
    22622264    } 
    22632265    }