[EP-underground] Re: Setting a date (as a sub-field)
Jonathan Nitzan <[email protected]> Thu, 28 May 2015 11:24:45 -0400
| Newsgroups | gmane.comp.web.eprints.general |
|---|---|
| Message-ID | <EMEW3|602b876cb904fa2ec0cd9379aede0636r4RGYM1beprints-underground-bounces|ecs.soton.ac.uk|[email protected]> |
Mike -- I've received this note. I assume it should have been addressed
to you.
Jonathan
On 28/05/2015 9:59 AM, Ian Stuart wrote:
> I'm extending my EPrints repository (EP 3.3.14) to hold multiple dates -
> so eprint_fields.pl has the following added:
>
>
> {
> 'name' => 'dates',
> 'type' => 'compound',
> 'multiple' => 1,
> 'fields' => [
> {
> 'sub_name' => 'date',
> 'type' => 'date',
> 'min_resolution' => 'year',
> },
> {
> 'sub_name' => 'type',
> 'type' => 'set',
> 'options' => [ 'submitted', 'accepted',
> 'published', 'completed', ],
> },
> ],
> },
> (and do the database update, and add the various phrases, and restart)
>
> I then run a bit of code to copy from $ep->{date} & $ep->{date_type}
> into my new structure:
>
> my $ds = $session->dataset( 'archive' );
> my $list = $ds->search;
> $list->map( sub {
> my( $session, $dataset, $eprint ) = @_;
> my ($date, $type);
> ($date, $type) = ($eprint->value('date'),
> $eprint->value('date_type'));
> if ($date) {
> my $new_date = {date => $date, date_type => $type};
> $eprint->set_value( 'dates', [$new_date] );
> }
> $eprint->commit;
> }
> } );
>
> The problem is that some dates are coming out the system as '2011-02' or
> '2008' and this is throwing the set_value routine:
>
> Dates: $VAR1 = {
> 'date' => '2009-11-09',
> 'date_type' => 'published'
> };
> ERROR: invalid input syntax for integer:
> "f75237ba80d51376a093ee1a825a42cd" at ../EPrints/DataObj.pm line 294.
>
> From http://wiki.eprints.org/w/Date_field this should work fine?
>
> Any thoughts?
>
--
Jonathan Nitzan
Political Science || Social and Political Thought
York University
4700 Keele St.
Toronto, Ontario, M3J-1P3
Canada
Voice: (416) 736-2100, ext. 88822
Fax: (416) 736-5686
Email: nitzan at yorku.ca
The Bichler & Nitzan Archives: http://bnarchives.net
Alternative site: http://yorku.academia.edu/JonathanNitzan
Capital as Power: http://capitalaspower.com
RECASP (journal): http://lha.uow.edu.au/hsi/research/recasp/articles/index.html
RECASP Essay Prize: http://lha.uow.edu.au/hsi/research/recasp/essayprize/index.html
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
e
e EPrints.org Underground Mailing List
e http://www.eprints.org/maillist.php
e
e To unsubscribe please send a message to [email protected] with
e the text "unsubscribe eprints-underground" (without quotes) in the
e message body.
e
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee