molten-trunk/molten5_withgrid/app/models/sfcontact.rb
# Sends a welcome email to the contact if they are a new contact.
# If the email has already been sent, then the welcome email is not sent. 
Sends a welcome email to the contact if they are a new contact.
If the email has already been sent, then the welcome email is not sent.
Sends a welcome email to the contact if they are a new contact . If the email has already been sent then the welcome email is not sent .
def send_welcome_email(sf_record_id)
    if contact = Contact.find(sf_record_id)
      if !contact.welcome_email_sent? and (self_service = SelfServiceUser.find_by_contact_id(sf_record_id) and self_service.is_active)
        contact.update_attribute('welcome_email_sent_at__c',Time.now)
        SfcontactMailer.deliver_welcome(self,contact,self_service.email)
        logger.info("Updating contact with id: #{contact.id}")
        logger.info("Contact Email Sent Time Updated: #{contact.welcome_email_sent_at__c}")
      else
        logger.info("Welcome email already sent to contact: #{self.email}")
      end
    else
      logger.info("Couldn't find associated contact: #{self.email}")
    end
  end
def send_welcome_email ( sf_record_id ) if contact = Contact . find ( sf_record_id ) if ! contact . welcome_email_sent? and ( self_service = SelfServiceUser . find_by_contact_id ( sf_record_id ) and self_service . is_active ) contact . update_attribute ( 'welcome_email_sent_at__c' , Time . now ) SfcontactMailer . deliver_welcome ( self , contact , self_service . email ) logger . info ( "Updating contact with id: #{contact.id}" ) logger . info ( "Contact Email Sent Time Updated: #{contact.welcome_email_sent_at__c}" ) else logger . info ( "Welcome email already sent to contact: #{self.email}" ) end else logger . info ( "Couldn't find associated contact: #{self.email}" ) end end
Sends a welcome email to the contact if they are a new contact.
Sends a welcome email to the contact if they are a new contact .
# only send if (a) the welcome email hasn't been sent and (b) the contact has an associated self service user and that user is active
sf_record_id