diff --git a/app/controllers/entities/contacts_controller.rb b/app/controllers/entities/contacts_controller.rb index aee77926b3..5e63f6686d 100644 --- a/app/controllers/entities/contacts_controller.rb +++ b/app/controllers/entities/contacts_controller.rb @@ -126,7 +126,7 @@ def myc_webhooks contact.update_attributes( :first_name => params[:first_name], - :preferred_name => params[:preferred_name], + :preferred_name => params[:preferred_name].gsub(/N\/A/, ""), :last_name => params[:last_name], :email => params[:email], :cf_gender => params[:gender], @@ -145,6 +145,10 @@ def myc_webhooks :cf_emergency_contact_relationship => params[:emergency_contact_relationship], :cf_emergency_contact_number => params[:emergency_contact_phone] ) + + if contact.first_name == contact.preferred_name + contact.preferred_name = nil + end if params[:first_time] == "yes" contact.tag_list << "first-myc-2014" unless contact.tag_list.include?("first-myc-2014") diff --git a/app/models/entities/contact.rb b/app/models/entities/contact.rb index e2d6004d42..48768f9cff 100644 --- a/app/models/entities/contact.rb +++ b/app/models/entities/contact.rb @@ -83,7 +83,7 @@ class Contact < ActiveRecord::Base rest.map{|r| scope = scope.or(r)} if scope scope else - t[:first_name].matches("%#{query}%").or(t[:last_name].matches("%#{query}%")) + t[:first_name].matches("%#{query}%").or(t[:last_name].matches("%#{query}%")).or(t[:preferred_name].matches("%#{query}%")) end other = t[:email].matches("%#{query}%").or(t[:alt_email].matches("%#{query}%")) @@ -129,10 +129,10 @@ def full_name(format = nil) if !self.cf_mailing_first_name.blank? && self.cf_mailing_first_name != self.first_name "#{self.first_name} #{self.last_name} (#{self.cf_mailing_first_name})" else - "#{self.first_name} #{self.last_name}" + "#{self.first_name} #{self.preferred_name.present? ? "(#{self.preferred_name})" : ""} #{self.last_name}" end else - "#{self.last_name}, #{self.first_name}" + "#{self.last_name}, #{self.first_name} #{self.preferred_name.present? ? "(#{self.preferred_name})" : ""}" end end alias :name :full_name diff --git a/app/views/contacts/_top_section.html.haml b/app/views/contacts/_top_section.html.haml index 8b93adb4d7..2a229d5ef3 100644 --- a/app/views/contacts/_top_section.html.haml +++ b/app/views/contacts/_top_section.html.haml @@ -10,6 +10,10 @@ %td .label.top{ :class => "#{Setting.require_last_names ? 'req' : nil}" } #{t :last_name}: = f.text_field :last_name + %tr + %td + .label.top #{t :preferred_name}: + = f.text_field :preferred_name %tr %td .label #{t :email}: diff --git a/app/views/events/contact_list.xls.builder b/app/views/events/contact_list.xls.builder index 4198a4bfca..14cdaa62b6 100644 --- a/app/views/events/contact_list.xls.builder +++ b/app/views/events/contact_list.xls.builder @@ -8,18 +8,11 @@ xml.Worksheet 'ss:Name' => (@event.name + " contact list") do I18n.t('name'), I18n.t('first_name'), I18n.t('last_name'), + I18n.t('preferred_name'), I18n.t('email'), I18n.t('alt_email'), I18n.t('phone'), I18n.t('mobile'), - I18n.t('fax'), - I18n.t('born_on'), - I18n.t('background_info'), - I18n.t('blog'), - I18n.t('linked_in'), - I18n.t('facebook'), - I18n.t('twitter'), - I18n.t('skype'), I18n.t('date_created'), I18n.t('date_updated'), I18n.t('assigned_to'), @@ -71,18 +64,11 @@ xml.Worksheet 'ss:Name' => (@event.name + " contact list") do contact.name, contact.first_name, contact.last_name, + contact.preferred_name, contact.email, contact.alt_email, contact.phone, contact.mobile, - contact.fax, - contact.born_on, - contact.background_info, - contact.blog, - contact.linkedin, - contact.facebook, - contact.twitter, - contact.skype, contact.created_at, contact.updated_at, contact.assignee.try(:name), diff --git a/app/views/registrations/_top_section.html.haml b/app/views/registrations/_top_section.html.haml index 2f8aeab891..46eeba7f6c 100644 --- a/app/views/registrations/_top_section.html.haml +++ b/app/views/registrations/_top_section.html.haml @@ -7,6 +7,16 @@ .label First time = f.check_box :first_time, :style => "float:left;" + %tr + %td + .label + International student (FOCUS) + = f.check_box :international_student, :style => "float:left;" + %td=spacer + %td + .label + Reqiures sleeping bag + = f.check_box :requires_sleeping_bag, :style => "float:left;" %tr %td .label @@ -42,7 +52,7 @@ %tr %td .label - Number of T-Shirts ordered + Number of T-Shirts/jumpers ordered = f.text_field :t_shirt_ordered %tr %td diff --git a/app/views_mobile/contacts/_top_section.html.haml b/app/views_mobile/contacts/_top_section.html.haml index 42ae00d7d7..b3c15e21e4 100644 --- a/app/views_mobile/contacts/_top_section.html.haml +++ b/app/views_mobile/contacts/_top_section.html.haml @@ -9,6 +9,10 @@ %td .label.top{ :class => "#{Setting.require_last_names ? 'req' : ''}" } #{t :last_name}: = f.text_field :last_name + %tr + %td + .label.top #{t :preferred_name}: + = f.text_field :preferred_name %tr %td .label #{t :email}: diff --git a/config/locales/en-US_fat_free_crm.yml b/config/locales/en-US_fat_free_crm.yml index 664df4e422..186a4e65a5 100644 --- a/config/locales/en-US_fat_free_crm.yml +++ b/config/locales/en-US_fat_free_crm.yml @@ -289,6 +289,7 @@ en-US: current_password: Current password edit_profile: Edit Profile first_name: First name + preferred_name: Preferred name google: Google IM gravatar_help: Not familiar with Gravatars? Learn about Gravatars image_file: Image file