# # EPrints Services - REF Package # # Version: 1.0 # # REF2 Report $c->{plugins}->{"Screen::REF::Report::REF2::View"}->{params}->{validate_selection} = sub { my( $user, $selection, $eprint, $ctx ) = @_; my $session = $user->{session}; my @problems; if( $selection->is_set( "details" ) ) { my @words = split /\s+/, $selection->value( "details" ); if( @words > 300 ) { push @problems, $session->html_phrase( "ref:validate:word_limit", field => $selection->{dataset}->field( "details" )->render_name( $session ), length => $session->make_text( scalar @words ), limit => $session->make_text( 300 ), ); } } if( $selection->is_set( "abstract" ) ) { my @words = split /\s+/, $selection->value( "abstract" ); if( @words > 100 ) { push @problems, $session->html_phrase( "ref:validate:word_limit", field => $selection->{dataset}->field( "abstract" )->render_name( $session ), length => $session->make_text( scalar @words ), limit => $session->make_text( 100 ), ); } } my $plugin = $session->plugin( "Export::REF2014" ); if( defined $plugin ) { $plugin->dataobj_to_refdata( $selection, eprint => $eprint, user => $user, problems => \@problems, ); } my $year = $eprint->value( "date" ); $year = "" if !defined $year; $year = substr($year,0,4); if( !$year || $year < 2008 || $year > 2013 ) { push @problems, $session->html_phrase( "ref:validate:year", year => $session->make_text( $year ), ); } return @problems; }; # REF1 Report $c->{plugins}->{"Screen::REF::Report::REF1::View"}->{params}->{validate_user} = sub { my( $user, $ctx ) = @_; my $session = $user->{session}; my @problems; my $type = $user->value( 'ref_category' ); unless( defined $type ) { push @problems, $session->html_phrase( "ref:validate_user:no_category"); return @problems; # can't go further, we must know the category } if( $type eq 'B' || $type eq 'D' ) { push @problems, $session->html_phrase( "ref:validate_user:wrong_category"); return @problems; # can't go further, we must know the category } # extra checks for Category A Staff: # for HEFCW institutions, whether the user is a research fellow or not # whether the user is an ECR (early career researcher) # ref_start_date # if between 1 Jan 2008 and 31 October 2013 # if user on a fixed-term contract, secondment, or period of unpaid leaves, start and end dates of the contract, 2ndment or unpaid leaves # internal_id as in the Institution's unique id (employee id or else) my $mf = [ 'internal_id', 'name_family', 'name_given' ]; if( $type eq 'A' ) { push @$mf, ( 'hesa', 'dob', 'fte' ); #, 'ref_start_date' ); } my $ds = $user->get_dataset; foreach( @$mf ) { next unless( $ds->has_field( "$_" ) ); unless( $user->is_set( "$_" ) ) { push @problems, $session->html_phrase( "ref:validate_user:missing:$_" ); } # FTE must be >= 0.2 if( "$_" eq 'fte' && $user->get_value( "$_") < 0.2 ) { push @problems, $session->html_phrase( "ref:validate_user:low_fte" ); } } return @problems; }; 1;