EPrints Technical Mailing List Archive
Message: #04273
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Setting a date (as a sub-field)
- To: eprints <eprints-tech@ecs.soton.ac.uk>
- Subject: [EP-tech] Setting a date (as a sub-field)
- From: Ian Stuart <Ian.Stuart@ed.ac.uk>
- Date: Thu, 28 May 2015 15:13:30 +0100
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? -- Ian Stuart. Developer: ORI, RJ-Broker, and OpenDepot.org Bibliographics and Multimedia Service Delivery team, EDINA, The University of Edinburgh. http://edina.ac.uk/ The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
- Follow-Ups:
- [EP-tech] Re: Setting a date (as a sub-field)
- From: "Field A.N." <af05v@ecs.soton.ac.uk>
- [EP-tech] Re: Setting a date (as a sub-field)
- Prev by Date: [EP-tech] Re: 2 IRStats Questions
- Next by Date: [EP-tech] Re: 2 IRStats Questions
- Previous by thread: [EP-tech] Migrating from D-space (with files)
- Next by thread: [EP-tech] Re: Setting a date (as a sub-field)
- Index(es):