From 0ecebfb65b273773cabe148221b11c79da5f7bb3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 26 Oct 2016 12:30:32 -0400 Subject: [PATCH] JBAS-1437 Backstage update authority 005 date values Signed-off-by: Bill Erickson --- KCLS/backstage/process-backstage-files.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/KCLS/backstage/process-backstage-files.pl b/KCLS/backstage/process-backstage-files.pl index bf1aebb878..ca69b520df 100755 --- a/KCLS/backstage/process-backstage-files.pl +++ b/KCLS/backstage/process-backstage-files.pl @@ -309,6 +309,8 @@ sub handle_modified_auths { while (my $record = $marc_batch->next()) { + modify_auth_005($record); + my @matches = find_matching_auths($record); push(@matches, find_replaced_auths($record)); @@ -322,6 +324,24 @@ sub handle_modified_auths { } } +# Update the 005 field to the current date +sub modify_auth_005 { + my $record = shift; + my $field_005 = $record->field('005'); + + # MARC 005-formatted date value + my $now_date = DateTime->now( + time_zone => 'local')->strftime('%Y%m%d%H%M%S.0'); + + if ($field_005) { + $field_005->update($now_date); + + } else { + $field_005 = MARC::Field->new('005', $now_date); + $record->insert_fields_ordered($field_005); + } +} + sub update_auth { my $marcxml = shift; -- 2.11.0