Class Contact
In: lib/contact.rb
Parent: ActiveRecord::Base

Methods

fullname   liferay_class   new  

Public Class methods

Creates new contact_

[Source]

    # File lib/contact.rb, line 22
22:   def initialize(params)
23:     super(params)
24: 
25:     if !self.companyid and self.user
26:       self.companyid = self.user.companyid
27:     end
28:     self.username ||= ''
29:     self.createdate   = Time.now
30:     self.modifieddate = Time.now
31:     if !self.accountid and self.company
32:       self.accountid = self.company.accountid
33:     end
34:     self.parentcontactid ||= 0
35:     self.firstname       ||= ''
36:     self.middlename      ||= ''
37:     self.lastname        ||= ''
38: 
39:     # values for prefixid and suffixid are defined in table listtype
40:     self.prefixid         ||= 0
41:     self.suffixid         ||= 0
42:     self.male=true if self.male.nil?
43:     self.birthday         ||= Time.mktime(1970,1,1)
44:     self.smssn            ||= ''
45:     self.aimsn            ||= ''
46:     self.icqsn            ||= ''
47:     self.jabbersn         ||= ''
48:     self.msnsn            ||= ''
49:     self.skypesn          ||= ''
50:     self.ymsn             ||= ''
51:     self.employeestatusid ||= ''
52:     self.employeenumber   ||= ''
53:     self.jobtitle         ||= ''
54:     self.jobclass         ||= ''
55:     self.hoursofoperation ||= ''
56:     self.facebooksn       ||= ''
57:     self.myspacesn        ||= ''
58:     self.twittersn        ||= ''
59: 
60:     self.save
61:   end

Public Instance methods

def save

  if !self.username and self.firstname and self.lastname
    self.username = fullname
  end
  super

end

[Source]

    # File lib/contact.rb, line 70
70:   def fullname
71:     (self.firstname.empty? and self.lastname.empty?) ?
72:       'Guest' : self.firstname+' '+self.lastname
73:   end

com.liferay.portal.model.Contact

[Source]

    # File lib/contact.rb, line 8
 8:   def liferay_class
 9:     'com.liferay.portal.model.Contact'
10:   end

[Validate]