app/models/imports/people_import.rb in artfully_ose-1.2.0 vs app/models/imports/people_import.rb in artfully_ose-1.3.0.pre1
- old
+ new
@@ -36,10 +36,18 @@
def row_valid?(parsed_row)
#We're doing this here because the error message for naming_details_available? is very bad
raise Import::RowError, "Please include a first name, last name, or email in this row: #{parsed_row.row}" unless attach_person(parsed_row).naming_details_available?
+ if parsed_row.birth_month.present?
+ raise Import::RowError, "Incorrect month: '#{parsed_row.birth_month}' in this row: #{parsed_row.row}" unless parsed_row.birth_month.to_i.between?(1,12)
+ end
+
+ if parsed_row.birth_day.present?
+ raise Import::RowError, "Incorrect day: '#{parsed_row.birth_day}' in this row: #{parsed_row.row}" unless parsed_row.birth_day.to_i.between?(1,31)
+ end
+
#We're bypassing the valid? check that used to be here because we're allowing dupe emails (they get merged later)
true
end
def error(parsed_row, person)
@@ -64,6 +72,6 @@
if !existing_person.save
error(parsed_row, existing_person)
end
existing_person
end
-end
\ No newline at end of file
+end