diff options
-rw-r--r-- | app/controllers/phones_controller.rb | 1 | ||||
-rw-r--r-- | app/models/phone.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 14735e6..3672390 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -46,6 +46,7 @@ class PhonesController < ApplicationController m = method( :"#{@phoneable.class.name.underscore}_phone_path" ) redirect_to m.( @phoneable, @phone ), :notice => t('phones.controller.successfuly_updated') else + set_fallback_sip_accounts render :edit end end diff --git a/app/models/phone.rb b/app/models/phone.rb index a59b003..4865a12 100644 --- a/app/models/phone.rb +++ b/app/models/phone.rb @@ -200,6 +200,10 @@ class Phone < ActiveRecord::Base # Sanitize MAC address. # def sanitize_mac_address + if self.mac_address.split(/:/).count == 6 && self.mac_address.length < 17 + splitted_mac_address = self.mac_address.split(/:/) + self.mac_address = splitted_mac_address.map{|part| (part.size == 1 ? "0#{part}" : part)}.join('') + end self.mac_address = self.mac_address.to_s.upcase.gsub( /[^A-F0-9]/, '' ) end |