Skip to content

Commit

Permalink
Fixes bugs with #144.
Browse files Browse the repository at this point in the history
  • Loading branch information
drn05r committed Sep 10, 2021
1 parent ce2909c commit 41f6f19
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions perl_lib/EPrints/MetaField/Subject.pm
Expand Up @@ -125,13 +125,31 @@ sub render_set_input
$self->{showtop},
0,
($self->{input_style} eq "short"?1:0) );
foreach my $value ( @{$obj->get_value( $self->{name} )} )
my ( $depospairs ) = $topsubj->get_subjects(
1,
$self->{showtop},
0,
($self->{input_style} eq "short"?1:0) );

my $values = $obj->get_value( $self->{name} );
$values ||= [];
$values = [ $values ] unless ref $values eq 'ARRAY';
foreach my $value ( @{$values} )
{
foreach my $pair ( @{$allpairs} )
{
if ( $pair->[0] eq $value )
{
unshift @{$pairs}, $pair;
my $depositable = 0;
foreach my $dpair ( @{$depospairs} )
{
if ( $dpair->[0] eq $value )
{
$depositable = 1;
last;
}
}
unshift @{$pairs}, $pair unless $depositable;
last;
}
}
Expand Down

0 comments on commit 41f6f19

Please sign in to comment.