eprintsug / rioxx2

Support for the RIOXX 2.0 Application Profile
4 stars 5 forks source link

Check for free_to_read causes EPrint::View not to load #28

Open drn05r opened 9 years ago

drn05r commented 9 years ago

On line 594 of zz_rioxx2.pl the following line causes the EPrints::View Screen plugin to fail to load for EPrint records that were created and have not been edited since the RIOXX2 plugin was installed:

unless( EPrints::Utils::is_set( $value->{free_to_read} ) )

The following error message is shown when the page fails to load is:

Can't use string ("0") as a HASH ref while "strict refs" in use at (eval 2377) line 594.

Suggesting that either $value is not defined as a HASH.

drn05r commented 9 years ago

This may be due to using an earlier version of the RIOXX2 plugin that did not set this field to a sensible value when the plugin was installed and created this field in the eprint table. However, it would be helpful if the check for whether free_to_read is set is a little more fault tolerant, so whatever teh sate of the field it doesn't cause the EPrint::View screen plugin to fail to load.

drn05r commented 9 years ago

I have used the following few lines as a catch for when this value is not properly set, prior to the unless( EPrints::Utils::is_set( $value->{free_to_read} ) ) line:

if ( ref($value) ne 'HASH' ) { push @problems, $repo->html_phrase( "rioxx2_validate_rioxx2_free_to_read:not_done_part_free_to_read" ); return @problems; }

drtjmb commented 9 years ago

Pull request please?

Tim

Timothy Miles-Board

Web & Repositories Development Specialist, University of London Computer Centre

020 7863 1342 | 07742 970 351 | timothy.miles-board@london.ac.ukmailto:timothy.miles-board@london.ac.uk | @drtjmb

The University of London is an exempt charity in England and Wales


From: David R Newman notifications@github.com Sent: 29 May 2015 3:11 PM To: eprintsug/rioxx2 Subject: Re: [rioxx2] Check for free_to_read causes EPrint::View not to load (#28)

I have used the following few lines as a catch for when this value is not properly set, prior to the unless( EPrints::Utils::is_set( $value->{free_to_read} ) ) line:

if ( ref($value) ne 'HASH' ) { push @problemshttps://github.com/problems, $repo->html_phrase( "rioxx2_validate_rioxx2_free_to_read:not_done_part_free_to_read" ); return @problemshttps://github.com/problems; }

Reply to this email directly or view it on GitHubhttps://github.com/eprintsug/rioxx2/issues/28#issuecomment-106819627.