https://wiki.eprints.org/w/index.php?title=Eprint_warnings.pl&feed=atom&action=historyEprint warnings.pl - Revision history2024-03-29T09:57:07ZRevision history for this page on the wikiMediaWiki 1.31.8https://wiki.eprints.org/w/index.php?title=Eprint_warnings.pl&diff=14275&oldid=prevDrn@ecs.soton.ac.uk: Added page about config file2022-01-23T11:46:52Z<p>Added page about config file</p>
<p><b>New page</b></p><div>{{dirs}}<br />
{{cfgd}}<br />
<br />
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.<br />
<br />
==Example==<br />
In this example warnings would be raised if the eprint item:<br />
# Has no documents uploaded.<br />
# Has non-public documents uploaded but no contact email address set.<br />
$c->{eprint_warnings} = sub<br />
{<br />
my( $eprint, $repository ) = @_;<br />
<br />
my @problems = ();<br />
<br />
my @docs = $eprint->get_all_documents;<br />
if( @docs == 0 )<br />
{<br />
push @problems, $repository->html_phrase( "warnings:no_documents" );<br />
}<br />
<br />
my $all_public = 1;<br />
foreach my $doc ( @docs )<br />
{<br />
if( $doc->value( "security" ) ne "public" )<br />
{<br />
$all_public = 0;<br />
}<br />
}<br />
<br />
if( !$all_public && !$eprint->is_set( "contact_email" ) )<br />
{<br />
push @problems, $repository->html_phrase( "warnings:no_contact_email" );<br />
}<br />
<br />
return( @problems );<br />
};</div>Drn@ecs.soton.ac.uk