From 36219e3eca1c9e9725291317d303e743d8588da9 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 12 Dec 2014 12:47:08 +0000 Subject: [PATCH] Generate an automatic UDB only if no explicit one was provided. --- lib/ZOOM/IRSpy.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 5e6519f..49e7932 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -382,8 +382,10 @@ sub _rewrite_zeerex_record { my($nok, $nall, $percent) = calc_reliability_stats($xc); modify_xml_document($xc, $_specialFields, { reliability => $percent }); - if (!defined $oldid) { - # New record: generate a UDB for it. + my $xpath = $_specialFields->{udb}->[3]; + my $value = $xc->findvalue($xpath); + if (!defined $oldid && (!defined $value || $value eq '')) { + # New record with no explicit UDB: generate a UDB for it. modify_xml_document($xc, $_specialFields, { udb => _next_udb() }); } -- 1.7.10.4