Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Eprint validate.pl
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{dirs}} {{cfgd}} This file contains configuration for validating EPrint data objects. The '''validate_eprint''' function tests the validity of the values set for the metadata fields for an EPrint. This usually happens when a user reaches the '''Deposit''' stage of the EPrint workflow. * '''<tt>$eprint</tt>''' is the [[API:EPrints/DataObj/EPrint|EPrint]] object being validated. * '''<tt>$repository</tt>''' is a [[API:EPrints/Repository|Repository]] object. * '''<tt>$for_archive</tt>''' is a boolean indicating whether the current validation is a precursor to the item being moved to the live archive. Its value make no difference for the default '''validate_document''' function. '''Example''' In this example, the eprint is checked to validate that at least one creator or editor is set. <pre> $c->{validate_eprint} = sub { my( $eprint, $repository, $for_archive ) = @_; my $xml = $repository->xml(); my @problems = (); # If we don't have creators (eg. for a book) then we # must have editor(s). To disable that rule, remove the # following block. if( !$eprint->is_set( "creators" ) && !$eprint->is_set( "editors" ) ) { my $fieldname = $xml->create_element( "span", class=>"ep_problem_field:creators" ); push @problems, $repository->html_phrase( "validate:need_creators_or_editors", fieldname=>$fieldname ); } return( @problems ); }; </pre> The '''skip_validation''' function is commented out by default but can be uncommented and used to define logic for EPrint data objects that should not be validated. This is mainly for when you may be doing a mass import of legacy data that may not have values for certain fields, as they were not historically required.
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Cfgd
(
edit
)
Template:Dirs
(
edit
)
Template:RefLinks
(
edit
)