Skip to content
Permalink
Browse files
allow unset fields when allow_null is set (#418)
* allow unset fields when allow_null is set

* use consisten check for existence
  • Loading branch information
phluid61 committed Aug 28, 2017
1 parent a878546 commit 2f9d827397680279d0a59808f8559306d0be8bb3
Showing with 21 additions and 4 deletions.
  1. +21 −4 perl_lib/EPrints/Update/Views.pm
@@ -1768,16 +1768,33 @@ sub group_items
my $values = $field->get_value( $item );
if( !$field->get_property( "multiple" ) )
{
$values = [$values];
if( EPrints::Utils::is_set( $values ) )
{
$values = [$values];
}
elsif( $opts->{allow_null} )
{
$values = [$field->empty_value];
}
else
{
next;
}
}
elsif( !scalar(@$values) )
{
$values = [$field->empty_value];
if( $opts->{allow_null} )
{
$values = [$field->empty_value];
}
else
{
next;
}
}
next if !$opts->{allow_null} && !EPrints::Utils::is_set( $values );
VALUE: foreach my $value ( @$values )
{
next VALUE unless EPrints::Utils::is_set( $value );
next VALUE unless EPrints::Utils::is_set( $value ) || $opts->{allow_null};
if( $opts->{tags} )
{
$value =~ s/\.$//;

0 comments on commit 2f9d827

Please sign in to comment.