lib/marc_cleanup/bib_rubymarc_fixes.rb
def fix_007(record)
    target_fields = record.fields('007')
    return record if target_fields.empty?
    target_fields.each do |field|
      field_index = record.fields.index(field)
      field_value = field.value
      rec_type = field_value[0]
      next unless %w[a c d f g h k m o q r s t v z].include? rec_type
      fixed_007 = rec_type
      specific_007 = field_value[1..-1]
      next unless specific_007
      case rec_type
      when 'a'
        fixed_007 << fix_map_007(specific_007)
      when 'c'
        fixed_007 << fix_electronic_007(specific_007)
      when 'd'
        fixed_007 << fix_globe_007(specific_007)
      when 'f'
        fixed_007 << fix_tactile_007(specific_007)
      when 'g'
        fixed_007 << fix_proj_007(specific_007)
      when 'h'
        fixed_007 << fix_microform_007(specific_007)
      when 'k'
        fixed_007 << fix_nonproj_007(specific_007)
      when 'm'
        fixed_007 << fix_motion_pic_007(specific_007)
      when 'o'
        fixed_007 << fix_kit_007(specific_007)
      when 'q'
        fixed_007 << fix_notated_mus_007(specific_007)
      when 'r'
        fixed_007 << fix_remote_007(specific_007)
      when 's'
        fixed_007 << fix_sound_rec_007(specific_007)
      when 't'
        fixed_007 << fix_text_007(specific_007)
      when 'v'
        fixed_007 << fix_video_007(specific_007)
      when 'z'
        fixed_007 << fix_unspec_007(specific_007)
      end
      record.fields[field_index].value = fixed_007
    end
    record
  end
### Replace obsolete values with current values when possible
Replace obsolete values with current values when possible
Replace obsolete values with current values when possible
def fix_007(record)
    target_fields = record.fields('007')
    return record if target_fields.empty?
    target_fields.each do |field|
      field_index = record.fields.index(field)
      field_value = field.value
      rec_type = field_value[0]
      next unless %w[a c d f g h k m o q r s t v z].include? rec_type
      fixed_007 = rec_type
      specific_007 = field_value[1..-1]
      next unless specific_007
      case rec_type
      when 'a'
        fixed_007 << fix_map_007(specific_007)
      when 'c'
        fixed_007 << fix_electronic_007(specific_007)
      when 'd'
        fixed_007 << fix_globe_007(specific_007)
      when 'f'
        fixed_007 << fix_tactile_007(specific_007)
      when 'g'
        fixed_007 << fix_proj_007(specific_007)
      when 'h'
        fixed_007 << fix_microform_007(specific_007)
      when 'k'
        fixed_007 << fix_nonproj_007(specific_007)
      when 'm'
        fixed_007 << fix_motion_pic_007(specific_007)
      when 'o'
        fixed_007 << fix_kit_007(specific_007)
      when 'q'
        fixed_007 << fix_notated_mus_007(specific_007)
      when 'r'
        fixed_007 << fix_remote_007(specific_007)
      when 's'
        fixed_007 << fix_sound_rec_007(specific_007)
      when 't'
        fixed_007 << fix_text_007(specific_007)
      when 'v'
        fixed_007 << fix_video_007(specific_007)
      when 'z'
        fixed_007 << fix_unspec_007(specific_007)
      end
      record.fields[field_index].value = fixed_007
    end
    record
  end
def fix_007 ( record ) target_fields = record . fields ( '007' ) return record if target_fields . empty? target_fields . each do | field | field_index = record . fields . index ( field ) field_value = field . value rec_type = field_value [ 0 ] next unless %w[ a c d f g h k m o q r s t v z ] . include? rec_type fixed_007 = rec_type specific_007 = field_value [ 1 .. - 1 ] next unless specific_007 case rec_type when 'a' fixed_007 << fix_map_007 ( specific_007 ) when 'c' fixed_007 << fix_electronic_007 ( specific_007 ) when 'd' fixed_007 << fix_globe_007 ( specific_007 ) when 'f' fixed_007 << fix_tactile_007 ( specific_007 ) when 'g' fixed_007 << fix_proj_007 ( specific_007 ) when 'h' fixed_007 << fix_microform_007 ( specific_007 ) when 'k' fixed_007 << fix_nonproj_007 ( specific_007 ) when 'm' fixed_007 << fix_motion_pic_007 ( specific_007 ) when 'o' fixed_007 << fix_kit_007 ( specific_007 ) when 'q' fixed_007 << fix_notated_mus_007 ( specific_007 ) when 'r' fixed_007 << fix_remote_007 ( specific_007 ) when 's' fixed_007 << fix_sound_rec_007 ( specific_007 ) when 't' fixed_007 << fix_text_007 ( specific_007 ) when 'v' fixed_007 << fix_video_007 ( specific_007 ) when 'z' fixed_007 << fix_unspec_007 ( specific_007 ) end record . fields [ field_index ] . value = fixed_007 end record end
Replace obsolete values with current values when possible
Replace obsolete values with current values when possible
record