small fix for nil values

This commit is contained in:
rulingcom 2025-11-01 00:28:41 +08:00
parent c5fe53d745
commit fce3571a84
1 changed files with 3 additions and 3 deletions

View File

@ -106,11 +106,11 @@ module Admin::PropertyHiresHelper
if field
case field.type.to_s.downcase
when "date"
print_format = print_format.gsub("{#{field_name}}", phire.send(field_name).strftime("%Y/%m/%d")) rescue print_format
print_format = print_format.gsub("{#{field_name}}", phire.send(field_name).strftime("%Y/%m/%d")) rescue print_format.gsub("{#{field_name}}", "")
when "datetime"
print_format = print_format.gsub("{#{field_name}}", phire.send(field_name).strftime("%Y/%m/%d %H:%M")) rescue print_format
print_format = print_format.gsub("{#{field_name}}", phire.send(field_name).strftime("%Y/%m/%d %H:%M")) rescue print_format.gsub("{#{field_name}}", "")
else
print_format = print_format.gsub("{#{field_name}}", phire.send(field_name).to_s)
print_format = print_format.gsub("{#{field_name}}", phire.send(field_name).to_s) rescue print_format.gsub("{#{field_name}}", "")
end
else
field = PHireField.where(:key => field_name, :property_id => phire.property_id).first