From 96356ee2fbbc1618fe41a097183d55b85a2eb12c Mon Sep 17 00:00:00 2001 From: David R Newman Date: Sat, 21 Dec 2024 10:53:36 +0000 Subject: [PATCH] Avoid changing coversheets_dirty setting for erroring documents --- bin/update_coversheets_dirty | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/update_coversheets_dirty b/bin/update_coversheets_dirty index 8078ad3..01e4495 100755 --- a/bin/update_coversheets_dirty +++ b/bin/update_coversheets_dirty @@ -62,11 +62,18 @@ $coversheets->map(sub { $documents->map(sub{ my( $session, $dataset, $document ) = @_; - if ( $unset_errors && defined $document->get_value( 'coversheet_error') && ( $document->get_value( 'coversheet_error') eq "1" || $document->get_value( 'coversheet_error') eq "TRUE" ) ) + if ( $document->get_value( 'coversheet_error' ) && ( $document->get_value( 'coversheet_error' ) eq "1" || $document->get_value( 'coversheet_error' ) eq "TRUE" ) ) { - print "Unsetting coversheet_error for document #".$document->id." for eprint #".$document->get_value( 'eprintid' )."\n" unless $quiet; - $document->set_value( "coversheet_error", undef ); - $document->commit; + if ( $unset_errors ) + { + print "Unsetting coversheet_error for document #".$document->id." for eprint #".$document->get_value( 'eprintid' )."\n" unless $quiet; + $document->set_value( "coversheet_error", undef ); + $document->commit; + } + else + { + return; + } } my $eprint = $document->get_eprint; return if $eprint->get_value( 'coversheets_dirty' ) eq "TRUE";