[EP-tech] Data object validation; $for_archive

John Salter J.Salter at leeds.ac.uk
Tue Oct 20 17:37:49 BST 2015

I'm trying to work out how the '$for_archive' flag works when validating EPrints (I suspect it doesn’t, but am hoping to be proved wrong. I want to use this feature).

Starting here: https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj.pm#L2046-L2047
The 'validate' method on a dataobject can take a '$for_archive' flag.
This *should* be set as true when the item is about to be moved into the live archive.

It is referenced in many places - passed method-to-method, but as far as I can tell, this value is not set anywhere (and therefore is never true).

Can anyone help me trace it through the EPrints code, and confirm that it is or isn't used (especially at the point where an EPrint is made live)?

The comments  https://github.com/eprints/eprints/blob/3.3/lib/defaultcfg/cfg.d/eprint_validate.pl#L13-L14
refer to 'comments at the start of the validation section'.
I think these were carried over from Eprints2 days when all the validation routines were in one place: http://www.eprints.org/files/eprints2/eprints-2.2/defaultcfg/ArchiveValidateConfig.pm 

#  $for_archive is a boolean flag (1 or 0) it is set to 0 when the
#  item is being validated as a submission and to 1 when the item is
#  being validated for submission to the actual archive. This allows
#  a stricter validation for editors than for submitters. A useful 
#  example would be that a deposit may have one of several format of
#  documents but the editor must ensure that it has a PDF before it
#  can be submitted into the main archive. If it doesn't have a PDF
#  file, then the editor will have to generate one.

Also in Eprints2, this is where the 'for_archive' gets set:
http://www.eprints.org/files/eprints2/eprints-2.2/perl_lib/EPrints/SubmissionForm.pm, Line 129


More information about the Eprints-tech mailing list