EPrints Technical Mailing List Archive

Message: #08940


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

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


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="">
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url="">