16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/models/license.rb', line 16
def update_agent_license
if self.status == "Actived"
agent = self.agent
agent.licenses.where("id != ?",self.id).update_all("status ='Deactived'")
agent.update_attributes({:license_number => self.license_number, :license_state_issued => self.license_state_issued,:license_issued_date => self.license_issued_date})
agent.push_notification_change_license("approved")
UserMailer.delay.send_license_status(agent,"approved")
elsif self.status =="Deactived"
agent = self.agent
agent.push_notification_change_license("rejected")
UserMailer.delay.send_license_status(agent,"rejected")
end
end
|