[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: Add validation only for certain item types?



How about something like:

if ( $eprint->get_value( 'type' ) eq 'book' )
{
                # do some validation
                ...
}


Cheers
Mark

Mark Gregson | Applications and Development Team Leader
Library eServices | Queensland University of Technology
Level 3 | R Block | Kelvin Grove Campus | GPO Box 2434 | Brisbane 4001
Phone: +61 7 3138 3782 | Web: http://eprints.qut.edu.au/<http://www.qut.edu.au/>
ABN: 83 791 724 622
CRICOS No: 00213J



From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Eliseo Gatchalian
Sent: Thursday, 6 November 2014 8:13 AM
To: 'eprints-tech at ecs.soton.ac.uk'
Subject: [EP-tech] Add validation only for certain item types?

Hi All,

I'm just wondering if anyone has added or know how to activate this validation only for certain item types?

>From eprint_validate.pl:
******
$c->{validate_eprint} = sub

   my ( $eprint, $session, $for_archive ) = @_;


   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( !$eprints->is_set( "creators" ) &&
                !$= $eprints->is_set( "editors" ) )

                my $fieldname = $session->make_element( "span", class=>"ep_problem_field:creators" );
                push @problems, $session->html_phrase (
                                                "validate:need_creators_or_editors",
                                                fieldname=>$fieldname );

   return( @problems );
};
*********


Thanks guys!




Best regards,

Ellis


________________________________

This electronic mail transmission is intended for the named recipients only. It may contain private and confidential information. If this has come to you in error you must take no action based upon it, nor must you copy it or show it to anyone; please telephone or email the sender at Wintec immediately and return the original email. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment which may be included with this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20141105/40dfafa6/attachment-0001.html