Skip to content
Snippets Groups Projects
Commit d921496d authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed event handling respecting age of events, complete rewrite of...

- fixed event handling respecting age of events, complete rewrite of _handle_deleted_or_purged_aips()
parent 56706772
Branches
No related tags found
No related merge requests found
......@@ -615,25 +615,21 @@ sub check_if_file_is_readable($filename) {
sub _handle_deleted_or_purged_aips($xp, $ret) {
my $amdsec_ie = $xp->findnodes($compiled_xpath_amdSec_ie)->[0];
my $is_deleted;
foreach my $state (qw(purged deleted)) {
my $dnx_ctx;
if ($state eq 'purged') {
$dnx_ctx = $xp->findnodes($xpath_if_purged_expr, $amdsec_ie)->[0];
}
else {
$dnx_ctx = $xp->findnodes($xpath_if_deleted_expr, $amdsec_ie)->[0];
}
$is_deleted = has_purged_entries($xp, $dnx_ctx);
if ($is_deleted) {
my $purged_state = get_purged_state($xp, $dnx_ctx);
$ret->{$state}->{state} = $purged_state;
$ret->{$state}->{reason} = get_purged_reasons($xp, $dnx_ctx)->[0];
$ret->{$state}->{note} = get_purged_notes($xp, $dnx_ctx)->[0];
$ret->{$state}->{date} = get_purged_dates($xp, $dnx_ctx)->[0];
$ret->{$state}->{authorized_by} = get_purged_authorized_by($xp, $dnx_ctx)->[0];
if ($state eq "purged") {last;}
}
my $latest_ctx = (
sort {
my $adate = get_anydelete_date($xp, $a);
my $bdate = get_anydelete_date($xp, $b);
$bdate cmp $adate
} $xp->findnodes($xpath_if_anydelete_event_expr, $amdsec_ie)
)[0]; # first element of list
my $is_deleted = has_anydelete_entries($xp, $latest_ctx);
if ($is_deleted) {
my $state = get_anydelete_state($xp, $latest_ctx);
$ret->{$state}->{state} = $state;
$ret->{$state}->{reason} = get_anydelete_reason($xp, $latest_ctx);
$ret->{$state}->{note} = get_anydelete_note($xp, $latest_ctx);
$ret->{$state}->{date} = get_anydelete_date($xp, $latest_ctx);
$ret->{$state}->{authorized_by} = get_anydelete_authorized_by($xp, $latest_ctx);
}
return $is_deleted;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment