From f2b72ef12ed2bfb2d942fd6654d8816f863b0970 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 5 Jul 2013 13:03:15 +0200 Subject: fix for java-script less browsers --- app/models/call_forward.rb | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'app/models/call_forward.rb') diff --git a/app/models/call_forward.rb b/app/models/call_forward.rb index a4bfbb5..159eb84 100644 --- a/app/models/call_forward.rb +++ b/app/models/call_forward.rb @@ -7,7 +7,8 @@ class CallForward < ActiveRecord::Base :hunt_group_id, :call_forwardable_type, :call_forwardable_id, :call_forwarding_destination, :position, :uuid, - :destinationable_type, :destinationable_id + :destinationable_type, :destinationable_id, + :destination_phone_number, :destination_greeting belongs_to :call_forwardable, :polymorphic => true belongs_to :destinationable, :polymorphic => true @@ -88,6 +89,30 @@ class CallForward < ActiveRecord::Base self.destinationable_id, delimeter, self.destinationable_type = destination_record.to_s.partition(':') end + def destination_phone_number + if self.destinationable_type.downcase == 'phonenumber' + return self.destination + end + end + + def destination_phone_number=(destination_number) + if self.destinationable_type.downcase == 'phonenumber' + self.destination = destination_number + end + end + + def destination_greeting + if self.destinationable_type.downcase == 'voicemailaccount' + return self.destination + end + end + + def destination_greeting=(destination_file) + if self.destinationable_type.downcase == 'voicemailaccount' + self.destination = destination_file + end + end + def toggle self.active = ! self.active return self.save -- cgit v1.2.3 From 961453a7a7d4926e837e9f9225074e3d0817f665 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 8 Jul 2013 13:24:52 +0200 Subject: destinationable_type can be nil --- app/models/call_forward.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/models/call_forward.rb') diff --git a/app/models/call_forward.rb b/app/models/call_forward.rb index 159eb84..0df2a35 100644 --- a/app/models/call_forward.rb +++ b/app/models/call_forward.rb @@ -90,25 +90,25 @@ class CallForward < ActiveRecord::Base end def destination_phone_number - if self.destinationable_type.downcase == 'phonenumber' + if self.destinationable_type.to_s.downcase == 'phonenumber' return self.destination end end def destination_phone_number=(destination_number) - if self.destinationable_type.downcase == 'phonenumber' + if self.destinationable_type.to_s.downcase == 'phonenumber' self.destination = destination_number end end def destination_greeting - if self.destinationable_type.downcase == 'voicemailaccount' + if self.destinationable_type.to_s.downcase == 'voicemailaccount' return self.destination end end def destination_greeting=(destination_file) - if self.destinationable_type.downcase == 'voicemailaccount' + if self.destinationable_type.to_s.downcase == 'voicemailaccount' self.destination = destination_file end end -- cgit v1.2.3