Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def update_contact_phone
- @phone = params[:contact_phone][:phone]
- @phone = 0 if @phone.blank?
- notice = "V polju telefon je potrebno vnesti le številke, <br /> brez minusov, pik, presledkov, itd...!" if not is_a_number?(@phone)
- @phone = "xxxxxxx" if @phone == 0 and params[:area][:code].size == 2
- @phone = "xxxxxx" if @phone == 0 and params[:area][:code].size == 3
- @phone = "xxxxx" if @phone == 0 and params[:area][:code].size == 4
- # notice = "Dolžina telefonske številke je napačna!" if @phone.size != 7 and params[:area][:code].size == 2
- # notice = "Dolžina telefonske številke je napačna!" if @phone.size != 6 and params[:area][:code].size == 3
- # notice = "Dolžina telefonske številke je napačna!" if @phone.size != 5 and params[:area][:code].size == 4
- if notice
- render :update do |page|
- page.replace_html "notice_row", notice
- end
- else
- @contact_phone = ContactPhone.find params[:id]
- @contact_phone.phone = params[:area][:code] + "-" + @phone
- @contact_phone.save
- @contacts = @contact_phone.company_contact.company.company_contacts
- render :update do |page|
- page.replace_html "edit_contact", ""
- page.replace_html "edit-user", :partial => 'list_company_contacts', :locals => {:contacts => @contacts}
- end
- end
- end
Add Comment
Please, Sign In to add comment