summaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-07-01 12:02:00 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-07-01 12:02:00 +0200
commit14363079481d3a985060820225b571aefd0e4a04 (patch)
tree8e226e860839bbfd518149eb2ce1db9e1ce1aec9 /app/controllers/api
parent9f23443a86ad145c2739ac289e42ac0f13ef0929 (diff)
Added a reverse lookup switch. closes #295
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/phone_book_entries_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/api/v1/phone_book_entries_controller.rb b/app/controllers/api/v1/phone_book_entries_controller.rb
index cae3259..6a39623 100644
--- a/app/controllers/api/v1/phone_book_entries_controller.rb
+++ b/app/controllers/api/v1/phone_book_entries_controller.rb
@@ -5,13 +5,14 @@ module Api
def index
query = params[:query]
+ switchboard = Switchboard.find(params[:switchboard_id])
return nil if query.blank?
current_ability = Ability.new(current_user)
phone_book_entries = PhoneBookEntry.accessible_by(current_ability)
- if query.match(/^\+?\d+$/) != nil
+ if query.match(/^\+?\d+$/) != nil && switchboard && switchboard.reverse_lookup_activated
# Find by phone number
phone_book_entries_ids = phone_book_entries.map{|entry| entry.id}
found_phone_numbers = PhoneNumber.