From 3ba444ee09abceac73a0507130035a4bf099ffc4 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 28 Feb 2013 03:13:31 -0500 Subject: update fax tiff file --- app/controllers/trigger_controller.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index 64a5f91..6cc9fa7 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -89,7 +89,6 @@ class TriggerController < ApplicationController rescue => e logger.error "PDF fax file could not be deleted: #{pdf_file} => #{e.inspect}" end - fax_document.tiff = nil fax_document.save fax_document.render_thumbnails else -- cgit v1.2.3 From 1353b9c0563da02f1b17e54d802f28221cdce982 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 28 Feb 2013 09:02:19 -0500 Subject: breadcrumbs --- app/controllers/calls_controller.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/calls_controller.rb b/app/controllers/calls_controller.rb index 5534b1b..22ff92d 100644 --- a/app/controllers/calls_controller.rb +++ b/app/controllers/calls_controller.rb @@ -3,6 +3,7 @@ class CallsController < ApplicationController load_resource :call before_filter :set_and_authorize_parent + before_filter :spread_breadcrumbs def index if @parent @@ -55,4 +56,20 @@ class CallsController < ApplicationController def set_and_authorize_parent @parent = @sip_account end + + def spread_breadcrumbs + if @parent.class == SipAccount + if @sip_account.sip_accountable.class == User + add_breadcrumb t('users.name'), tenant_users_path(@sip_account.sip_accountable.current_tenant) + add_breadcrumb @sip_account.sip_accountable, tenant_user_path(@sip_account.sip_accountable.current_tenant, @sip_account.sip_accountable) + add_breadcrumb t('sip_accounts.index.page_title'), user_sip_accounts_path(@sip_account.sip_accountable) + add_breadcrumb @sip_account, user_sip_account_path(@sip_account.sip_accountable, @sip_account) + add_breadcrumb t('calls.index.page_title'), sip_account_calls_path(@sip_account) + elsif @sip_account.sip_accountable.class == Tenant + add_breadcrumb t('sip_accounts.index.page_title'), tenant_sip_accounts_path(@sip_account.sip_accountable) + add_breadcrumb @sip_account, tenant_sip_account_path(@sip_account.sip_accountable, @sip_account) + add_breadcrumb t('calls.index.page_title'), sip_account_calls_path(@sip_account) + end + end + end end -- cgit v1.2.3 From 6238abea422a1be14d5f3d8cbacd78f2e72fd466 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 28 Feb 2013 09:09:10 -0500 Subject: group defaults --- app/controllers/groups_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 74ad7c8..d48707c 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -11,7 +11,7 @@ class GroupsController < ApplicationController end def new - @group = Group.new + @group.active = true; end def create -- cgit v1.2.3 From b8425f5453eab4a0fe475952af89d55ace45878e Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 3 Mar 2013 04:03:24 -0500 Subject: firewall restart after intruder changes --- app/controllers/intruders_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb index d3c767e..bdda230 100644 --- a/app/controllers/intruders_controller.rb +++ b/app/controllers/intruders_controller.rb @@ -2,7 +2,8 @@ class IntrudersController < ApplicationController load_and_authorize_resource :intruder def index - @intruders = Intruder.order('list_type ASC, contact_last DESC').all + @intruders = Intruder.order('list_type ASC, contact_last DESC') + @list_types = @intruders.pluck(:list_type).uniq.sort spread_breadcrumbs end -- cgit v1.2.3 From 7ec2f96979317912b464b801731c5d10be538e6d Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 4 Mar 2013 02:25:17 -0500 Subject: missing url fixed --- app/controllers/conference_invitees_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/conference_invitees_controller.rb b/app/controllers/conference_invitees_controller.rb index ce55b5a..e891ebc 100644 --- a/app/controllers/conference_invitees_controller.rb +++ b/app/controllers/conference_invitees_controller.rb @@ -58,7 +58,7 @@ class ConferenceInviteesController < ApplicationController def destroy @conference_invitee.destroy - redirect_to conference_invitees_url, :notice => t('conference_invitees.controller.successfuly_destroyed') + redirect_to conference_conference_invitees_url(@conference), :notice => t('conference_invitees.controller.successfuly_destroyed') end private -- cgit v1.2.3 From 295ca363ad12150b7a029075e915574afd61c82e Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 4 Mar 2013 02:39:21 -0500 Subject: call_forwards controler fixed --- app/controllers/call_forwards_controller.rb | 48 ++++++++++++++++------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb index 34fb77a..b30ee9e 100644 --- a/app/controllers/call_forwards_controller.rb +++ b/app/controllers/call_forwards_controller.rb @@ -1,7 +1,10 @@ class CallForwardsController < ApplicationController load_resource :phone_number load_resource :sip_account - load_and_authorize_resource :call_forward, :through => [:phone_number, :sip_account] + load_resource :automatic_call_distributor + load_resource :hunt_group + + load_and_authorize_resource :call_forward, :through => [:phone_number, :sip_account, :automatic_call_distributor, :hunt_group] before_filter :set_and_authorize_parent before_filter :spread_breadcrumbs @@ -81,7 +84,7 @@ class CallForwardsController < ApplicationController private private def set_and_authorize_parent - @parent = @sip_account || @phone_number + @parent = @phone_number || @sip_account || @automatic_call_distributor || @hunt_group authorize! :read, @parent end @@ -90,27 +93,30 @@ class CallForwardsController < ApplicationController if @parent.class == PhoneNumber && @parent.phone_numberable_type == 'SipAccount' @sip_account = @parent.phone_numberable end - if @sip_account.sip_accountable_type == 'User' - @user = @sip_account.sip_accountable - if @parent.class == PhoneNumber - add_breadcrumb t("users.index.page_title"), tenant_users_path(@user.current_tenant) - add_breadcrumb @user, tenant_users_path(@user.current_tenant, @user) - add_breadcrumb t("sip_accounts.index.page_title"), user_sip_accounts_path(@user) - add_breadcrumb @sip_account, user_sip_account_path(@user, @sip_account) - add_breadcrumb t("phone_numbers.index.page_title"), sip_account_phone_numbers_path(@sip_account) - add_breadcrumb @parent, sip_account_phone_number_path(@sip_account, @parent) - elsif @parent.class == SipAccount - add_breadcrumb t("users.index.page_title"), tenant_users_path(@user.current_tenant) - add_breadcrumb @user, tenant_users_path(@user.current_tenant, @user) - add_breadcrumb t("sip_accounts.index.page_title"), user_sip_accounts_path(@user) + + if @sip_account + if @sip_account.sip_accountable_type == 'User' + @user = @sip_account.sip_accountable + if @parent.class == PhoneNumber + add_breadcrumb t("users.index.page_title"), tenant_users_path(@user.current_tenant) + add_breadcrumb @user, tenant_users_path(@user.current_tenant, @user) + add_breadcrumb t("sip_accounts.index.page_title"), user_sip_accounts_path(@user) + add_breadcrumb @sip_account, user_sip_account_path(@user, @sip_account) + add_breadcrumb t("phone_numbers.index.page_title"), sip_account_phone_numbers_path(@sip_account) + add_breadcrumb @parent, sip_account_phone_number_path(@sip_account, @parent) + elsif @parent.class == SipAccount + add_breadcrumb t("users.index.page_title"), tenant_users_path(@user.current_tenant) + add_breadcrumb @user, tenant_users_path(@user.current_tenant, @user) + add_breadcrumb t("sip_accounts.index.page_title"), user_sip_accounts_path(@user) + end + end + if @sip_account.sip_accountable_type == 'Tenant' + @tenant = @sip_account.sip_accountable + add_breadcrumb t("sip_accounts.index.page_title"), tenant_sip_accounts_path(@tenant) + add_breadcrumb @sip_account, tenant_sip_account_path(@tenant, @sip_account) end end - if @sip_account.sip_accountable_type == 'Tenant' - @tenant = @sip_account.sip_accountable - add_breadcrumb t("sip_accounts.index.page_title"), tenant_sip_accounts_path(@tenant) - add_breadcrumb @sip_account, tenant_sip_account_path(@tenant, @sip_account) - end - + m = method( :"#{@parent.class.name.underscore}_call_forwards_url" ) add_breadcrumb t("call_forwards.index.page_title"), m.(@parent) if @call_forward && !@call_forward.new_record? -- cgit v1.2.3 From 45fe4f5022f7181aa5d6e66f03ba3c8cf281879a Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 4 Mar 2013 10:41:59 -0500 Subject: sort gs_parameters by entity+section --- app/controllers/gs_parameters_controller.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index bd8b44b..106ce76 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -4,9 +4,15 @@ class GsParametersController < ApplicationController before_filter :spread_breadcrumbs def index - @gs_parameters_unordered = GsParameter.scoped - @gs_parameters = GsParameter.order([:section, :name]) - @sections = @gs_parameters.pluck(:section).uniq.sort + @gs_parameters = GsParameter.order([:entity, :section, :name]) + + @entities = Hash.new() + @gs_parameters.each do |parameter| + if !@entities[parameter.entity] + @entities[parameter.entity] = Hash.new() + end + @entities[parameter.entity][parameter.section] = true + end end def show -- cgit v1.2.3 From 2f2276dc424196ace5d1859dfa3d3999926effce Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 5 Mar 2013 01:45:31 -0500 Subject: bypassing softkeys controller --- app/controllers/softkeys_controller.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/softkeys_controller.rb b/app/controllers/softkeys_controller.rb index c9e8c20..9179d8c 100644 --- a/app/controllers/softkeys_controller.rb +++ b/app/controllers/softkeys_controller.rb @@ -2,7 +2,7 @@ class SoftkeysController < ApplicationController load_and_authorize_resource :sip_account, :except => [:sort] load_and_authorize_resource :softkey, :through => [:sip_account], :except => [:sort] - before_filter :set_available_call_forwards_and_softkey_functions, :only => [ :new, :edit, :update ] + before_filter :set_available_softkey_functions, :only => [ :new, :edit, :update ] before_filter :spread_breadcrumbs, :except => [:sort] def index @@ -54,12 +54,8 @@ class SoftkeysController < ApplicationController render nothing: true end - private - - def set_available_call_forwards_and_softkey_functions - @available_call_forwards = @softkey.possible_blf_call_forwards - + def set_available_softkey_functions @softkey_functions = [] SoftkeyFunction.accessible_by(current_ability, :read).each do |softkey_function| if GuiFunction.display?("softkey_function_#{softkey_function.name.downcase}_field_in_softkey_form", current_user) -- cgit v1.2.3 From fbbbb9dfe10ad8b25d075e00f4a149086b7c27a5 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 5 Mar 2013 08:30:52 +0100 Subject: send fax notification --- app/controllers/trigger_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index 6cc9fa7..8e70ef2 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -84,6 +84,7 @@ class TriggerController < ApplicationController fax_document.state = 'successful' if fax_document.save + Notifications.new_fax(fax_document).deliver begin File.delete(pdf_file) rescue => e -- cgit v1.2.3 From a710d0d8033c84b72e1a6395adfbd6beebf80730 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 6 Mar 2013 06:38:08 -0500 Subject: collect errors --- app/controllers/trigger_controller.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index 8e70ef2..5e836c4 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -62,12 +62,14 @@ class TriggerController < ApplicationController def fax if !params[:fax_account_id].blank? fax_account = FaxAccount.where(:id => params[:fax_account_id].to_i).first + errors = Array.new() if fax_account fax_account.fax_documents.where(:state => 'received').each do |fax_document| pdf_file = fax_document.tiff_to_pdf if !pdf_file + errors << "#{fax_document.tiff} cound not be converted" fax_document.state = 'unsuccessful' fax_document.save next @@ -89,15 +91,21 @@ class TriggerController < ApplicationController File.delete(pdf_file) rescue => e logger.error "PDF fax file could not be deleted: #{pdf_file} => #{e.inspect}" + errors << "#{pdf_file} cound not be deleted" end fax_document.save fax_document.render_thumbnails else + errors << "#{fax_document.id} cound not be saved" fax_document.state = 'unsuccessful' fax_document.save end end - + else + errors << "fax_account=#{params[:fax_account_id]} not found" + end + + if errors.count == 0 render( :status => 200, :layout => false, @@ -105,11 +113,11 @@ class TriggerController < ApplicationController :text => "", ) else - render( - :status => 404, + render( + :status => 501, :layout => false, :content_type => 'text/plain', - :text => "", + :text => "", ) end end -- cgit v1.2.3 From 287e9d8fe964b0b0449732597f1f5ef5057cf4b3 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 6 Mar 2013 06:39:15 -0500 Subject: Abort on conversion errors --- app/controllers/fax_documents_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/fax_documents_controller.rb b/app/controllers/fax_documents_controller.rb index c2b3083..43852c6 100644 --- a/app/controllers/fax_documents_controller.rb +++ b/app/controllers/fax_documents_controller.rb @@ -61,8 +61,14 @@ class FaxDocumentsController < ApplicationController @fax_document = @fax_account.fax_documents.build(params[:fax_document]) @fax_document.retry_counter = @fax_account.retries if @fax_document.save - @fax_document.queue_for_sending! - redirect_to fax_account_fax_document_path(@fax_document.fax_account, @fax_document), :notice => t('fax_documents.controller.successfuly_created') + if @fax_document.tiff.blank? + @fax_document.destroy + @fax_document.errors.add(:document, t('fax_documents.controller.tiff_not_created')) + render :new + else + @fax_document.queue_for_sending! + redirect_to fax_account_fax_document_path(@fax_document.fax_account, @fax_document), :notice => t('fax_documents.controller.successfuly_created') + end else render :new end -- cgit v1.2.3 From 2964ebf277568536ac215f3a651e1841a73d68f8 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 7 Mar 2013 03:11:28 -0500 Subject: call origination fixed --- app/controllers/calls_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/calls_controller.rb b/app/controllers/calls_controller.rb index 22ff92d..9d85a10 100644 --- a/app/controllers/calls_controller.rb +++ b/app/controllers/calls_controller.rb @@ -18,11 +18,11 @@ class CallsController < ApplicationController protocol, separator, phone_number = params[:url].partition(':') if ! phone_number.blank? @call = @parent.calls.new() - @call.dest = phone_number + @call.destination = phone_number end elsif !params[:number].blank? @call = @parent.calls.new() - @call.dest = params[:number] + @call.destination = params[:number] end end @@ -31,8 +31,7 @@ class CallsController < ApplicationController end def create - params[:call][:sip_account] = @sip_account - @call = Call.create(params[:call]) + @call = @sip_account.calls.create(params[:call]) if @call && @call.call m = method( :"#{@parent.class.name.underscore}_calls_url" ) -- cgit v1.2.3