[EP-tech] How to delete succeeds-field?

David R Newman drn at ecs.soton.ac.uk
Thu May 19 15:04:12 BST 2022


Hi Thomas and Yuri,

I think the following fix to line 1744 of 
/opt/eprints3/perl_lib/EPrints/DataObj/EPrint.pm for EPrints 3.4.2 will 
resolve your main problem:

if( *defined $parent &&* $parent->get_value( "eprint_status" ) eq 
"archive" )

This is inside the code block for the in_thread function.  It changes:

sub in_thread
{
     my( $self, $field ) = @_;

         if( $self->later_in_thread( $field )->count > 0 )
         {
                 return 1;
         }
         if( $self->is_set( $field->name ) )
         {
                 my $parentid = $self->get_value( $field->name );
                 my $dataset = $self->{session}->dataset( "eprint" );
                 my $parent = $dataset->dataobj( $parentid );
                 if( $parent->get_value( "eprint_status" ) eq "archive" )
                 {
                         return 1;
                 }
         }
}

To:

sub in_thread
{
     my( $self, $field ) = @_;

         if( $self->later_in_thread( $field )->count > 0 )
         {
                 return 1;
         }
         if( $self->is_set( $field->name ) )
         {
                 my $parentid = $self->get_value( $field->name );
                 my $dataset = $self->{session}->dataset( "eprint" );
                 my $parent = $dataset->dataobj( $parentid );
                 if( defined $parent && $parent->get_value( 
"eprint_status" ) eq "archive" )
                 {
                         return 1;
                 }
         }
}

I further tested with deleting the middle item (151) of three items where:

152 -succeeds-> 151 -succeeds-> 98

This breaks the chain which means neither 152 nor 98 displays the 
"Available Versions of this Item" section on their abstract pages but 
the fix to try to tie the chain together back together felt like 
something overly complicate to implement and may deal with this case but 
might break in other scenarios yet to be considered.  So as deletion of 
151 does not leave anything horribly broken with the fix I have 
introduced in 3.4.3, I thought it best to leave this along.  In 
combination with the improvement to prevent previously live items from 
being fully deleted, the chances of this breaking horribly in future is 
much more limited.  Although retiring 151 as opposed to completely 
deleting it, will have the same effect on the "Available Versions of 
this Item" sections for 152 and 98.

Regards

David Newman

On 19/05/2022 14:02, Yuri Carrer via Eprints-tech wrote:
> CAUTION: This e-mail originated outside the University of Southampton.
>
> Isn't the reverse? I mean the missing eprint has the succeeds field that
> points to an existing eprint.
>
> Thomas: I've found a solution. Go to:
>
> /cgi/users/home?screen=Listing&dataset=eprint (Manage records on the top
> bar -> Eprints)
>
> and search the id of the record deleted or with problems. Then destroy
> it (the dust bin) and then regenerate the abstracts, the link to the
> missing one is gone.
>
> If you don't even have it in records, you've to go with the db.
>
> Mine was an Eprints 3.1.X and I didn't had the manage records.
>
> I think that using the db in this situation is easier because the
> succeeds is just a field and there should be any problem changing it (it
> is not indexed or used elsewhere).
>
> Il 19/05/22 13:04, David R Newman ha scritto:
>> the succeeding eprint still has its succeeds field set with a now
>> missing eprint ID
> --
> Yuri Carrer
>
>    CAB - Centro di Ateneo per le Biblioteche, Università di Padova
>    Tel: 049/827 9712 - Via Beato Pellegrino, 28 - Padova
>
>
> *** Options:http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0fcf4ca49f6c431c5af508da39a073ff%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637885658536799953%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OrTD0HVBSmZ%2FS6wBCWWF4g435dLSTitmOHFMMgC%2FM98%3D&reserved=0
> *** EPrints community wiki:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0fcf4ca49f6c431c5af508da39a073ff%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637885658536799953%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2BsBueSlmLKauzNa%2B1naJfLqq%2FA88NL0k%2Fryh6149BDQ%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20220519/c08c9f3c/attachment.html 


More information about the Eprints-tech mailing list