diff --git a/app/models/freereg1_csv_entry.rb b/app/models/freereg1_csv_entry.rb index 15984102d..60d6128a8 100644 --- a/app/models/freereg1_csv_entry.rb +++ b/app/models/freereg1_csv_entry.rb @@ -41,12 +41,12 @@ class Freereg1CsvEntry field :film, type: String field :film_number, type: String field :suffix, type: String + field :alternate_forenames, type: Array #new common fields field :image_file_name, type: String field :notes_from_transcriber, type: String - #original baptism fields field :baptism_date, type: String #actual date as written field :birth_date, type: String #actual date as written @@ -123,6 +123,7 @@ class Freereg1CsvEntry field :place_of_death, type: String field :memorial_information, type: String field :burial_parish, type: String + field :relative_occupation, type: String #original marriage fields @@ -915,18 +916,11 @@ def errors_in_fields errors.add(:film_number, 'Invalid characters') end - unless FreeregValidations.cleantext(consecrated_ground) - errors.add(:consecrated_ground, 'Invalid characters') - - end + unless FreeregValidations.cleantext(suffix) errors.add(:suffix, 'Invalid characters') - end - unless FreeregValidations.cleantext(burial_parish) - errors.add(:burial_parish, 'Invalid characters') - end case @@ -959,6 +953,7 @@ def errors_in_fields errors.add(:bride_father_occupation, 'Invalid characters') end + unless FreeregValidations.cleantext(bride_father_surname) errors.add(:bride_father_surname, 'Invalid characters') @@ -1417,6 +1412,16 @@ def errors_in_fields unless FreeregValidations.cleanage(person_age) errors.add(:person_age, 'Invalid age') end + unless FreeregValidations.cleantext(burial_parish) + errors.add(:burial_parish, 'Invalid characters') + end + unless FreeregValidations.cleantext(consecrated_ground) + errors.add(:consecrated_ground, 'Invalid characters') + + end + unless FreeregValidations.cleantext(relative_occupation) + errors.add(:relative_occupation, 'Invalid characters') + end if check_embargo rule = embargoes.where(record_type: 'bu', period_type: 'period').first errors.add(:burial, 'Cannot compute end of embargo') if rule.present? && year.blank? diff --git a/lib/freereg1_translator.rb b/lib/freereg1_translator.rb index 0af0bd02b..a7070e906 100644 --- a/lib/freereg1_translator.rb +++ b/lib/freereg1_translator.rb @@ -108,12 +108,24 @@ def self.translate_names_marriage(entry) # first_name: bride_forename # last_name: bride_surname names << { :role => 'b', :type => 'primary', :first_name => entry.bride_forename, :last_name => entry.bride_surname } + if entry.alternate_forenames.present? + alternate_forenames = entry.alternate_forenames + alternate_forenames.each{ |alt_fn| + names << { role: 'b', type: 'primary', first_name: alt_fn, last_name: entry.bride_forename } + } + end # - role: g # type: primary # fields: # first_name: groom_forename # last_name: groom_surname names << { :role => 'g', :type => 'primary', :first_name => entry.groom_forename, :last_name => entry.groom_surname } + if entry.alternate_forenames.present? + alternate_forenames = entry.alternate_forenames + alternate_forenames.each{ |alt_fn| + names << { role: 'g', type: 'primary', first_name: alt_fn, last_name: entry.groom_surname } + } + end # # - role: gf # type: other @@ -171,6 +183,12 @@ def self.translate_names_burial(entry) names << { role: 'bu', type: 'primary', first_name: entry.burial_person_forename||"", last_name: entry.female_relative_surname } when entry.burial_person_surname.present? names << { role: 'bu', type: 'primary', first_name: entry.burial_person_forename||"", last_name: entry.burial_person_surname } + if entry.alternate_forenames.present? + alternate_forenames = entry.alternate_forenames + alternate_forenames.each{ |alt_fn| + names << { role: 'bu', type: 'primary', first_name: alt_fn, last_name: entry.burial_person_surname } + } + end end # names << { :role => 'bu', :type => 'primary', :first_name => entry.burial_person_forename||"", :last_name => entry.burial_person_surname.present? ? entry.burial_person_surname : alternate_surname } @@ -227,6 +245,12 @@ def self.translate_names_baptism(entry) names << { role: 'ba', type: 'primary', first_name: entry.person_forename||"", last_name: entry.mother_surname } when entry.person_surname.present? names << { role: 'ba', type: 'primary', first_name: entry.person_forename||"", last_name: entry.person_surname } + if entry.alternate_forenames.present? + alternate_forenames = entry.alternate_forenames + alternate_forenames.each{ |alt_fn| + names << { role: 'ba', type: 'primary', first_name: alt_fn, last_name: entry.person_surname } + } + end end #forename = entry.person_forename || "" #entry.person_surname.present? ? surname = entry.person_surname : surname = nil diff --git a/lib/freereg_options_constants.rb b/lib/freereg_options_constants.rb index 8f9127e15..04962f642 100644 --- a/lib/freereg_options_constants.rb +++ b/lib/freereg_options_constants.rb @@ -9,7 +9,7 @@ module FreeregOptionsConstants 'witness6_surname', 'witness7_forename', 'witness7_surname', 'witness8_forename', 'witness8_surname']; ADDITIONAL_BURIAL_FIELDS = ['death_date', 'burial_person_title', 'male_relative_title', 'female_relative_surname', 'female_relative_title', - 'cause_of_death', 'burial_location_information', 'place_of_death', 'memorial_information']; + 'cause_of_death', 'burial_location_information', 'place_of_death', 'memorial_information', 'relative_occupation']; ADDITIONAL_MARRIAGE_FIELDS = ['contract_date', 'bride_title', 'bride_marked', 'bride_father_title', 'bride_mother_forename', 'bride_mother_surname', 'bride_mother_title', 'bride_mother_occupation', 'groom_title', 'groom_marked', 'groom_father_title', @@ -242,7 +242,7 @@ module FreeregOptionsConstants 'burial_person_surname', 'burial_person_title', 'relationship','person_occupation', 'consecrated_ground', 'male_relative_forename', 'relative_surname', 'male_relative_title', 'female_relative_forename', 'female_relative_surname', 'female_relative_title', 'person_age', 'burial_person_abode', 'cause_of_death', 'burial_location_information', 'place_of_death', 'memorial_information', - 'notes', 'notes_from_transcriber', 'film', 'film_number', 'image_file_name']; + 'notes', 'notes_from_transcriber', 'film', 'film_number', 'image_file_name', 'relative_occupation']; EXTENDED_MARRIAGE_LAYOUT = ['register_entry_number', 'marriage_date', 'contract_date', 'marriage_by_licence', 'groom_forename', 'groom_surname', 'groom_title', 'groom_age', 'groom_parish', 'groom_condition', 'groom_occupation', 'groom_abode', 'groom_marked', 'groom_father_forename', 'groom_father_surname', 'groom_father_occupation', diff --git a/lib/new_freereg_csv_update_processor.rb b/lib/new_freereg_csv_update_processor.rb index 52c0e2e0a..e2f39044c 100644 --- a/lib/new_freereg_csv_update_processor.rb +++ b/lib/new_freereg_csv_update_processor.rb @@ -1614,6 +1614,7 @@ def process_burial_data_fields(csvrecords,csvfile,project,line) @data_record[:relative_surname] = Unicode::upcase(@data_record[:relative_surname]) unless @data_record[:relative_surname].nil? @data_record[:burial_person_surname] = Unicode::upcase( @data_record[:burial_person_surname]) unless @data_record[:burial_person_surname].nil? @data_record[:female_relative_surname] = Unicode::upcase( @data_record[:female_relative_surname]) unless @data_record[:female_relative_surname].nil? + @data_record[:alternate_forenames] = @data_record[:alternate_forenames].split(",").map(&:strip) @data_record[:processed_date] = Time.now csvfile.data[line] = @data_record