⧼vector-jumptocontent⧽

Eprint warnings.pl

From EPrints Documentation


Back to cfg.d

This file contains configuration for raising warnings for EPrint data objects within the eprint_warnings functiom. Unlike eprint_validate.pl warnings do not prevent a user from depositing an eprint item, they use advise them that they may have forgotten to add something or some field is not that format that would normally be expected.

Example

In this example warnings would be raised if the eprint item:

  1. Has no documents uploaded.
  2. Has non-public documents uploaded but no contact email address set.
$c->{eprint_warnings} = sub
{
  my( $eprint, $repository ) = @_;

  my @problems = ();

  my @docs = $eprint->get_all_documents;
  if( @docs == 0 )
  {
    push @problems, $repository->html_phrase( "warnings:no_documents" );
  }

  my $all_public = 1;
  foreach my $doc ( @docs )
  {
    if( $doc->value( "security" ) ne "public" )
    {
        $all_public = 0;
    }
  }

  if( !$all_public && !$eprint->is_set( "contact_email" ) )
  {
    push @problems, $repository->html_phrase( "warnings:no_contact_email" );
  }

  return( @problems );
};