From de5448b7a042dbdc029739731af739a8435f9c62 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 7 Aug 2018 14:13:00 +0630 Subject: [PATCH] check function for order and bank --- app/controllers/application_controller.rb | 30 ---------------- .../concerns/login_verification.rb | 34 ++++++++++++++++++- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4ad0c42a..13de03e6 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,36 +21,6 @@ class ApplicationController < ActionController::Base def shop_detail @shop = Shop.first end - - def order_reservation - order_reserve = Lookup.collection_of('order_reservation') - status = false - if !order_reserve.empty? - order_reserve.each do |order| - if order[0] == 'OrderReservation' - if order[1] == '1' - status = true - end - end - end - end - return status - end - - def bank_integration - bank_integration = Lookup.collection_of('bank_integration') - status = false - if !bank_integration.empty? - bank_integration.each do |bank| - if bank[0] == 'Bank Integration' - if bank[1] == '1' - status = true - end - end - end - end - return status - end end diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index 590fdcbc..78864e34 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -3,7 +3,7 @@ module LoginVerification included do before_action :authenticate_session_token - helper_method :current_company, :current_login_employee, :current_user, :get_cashier + helper_method :current_company, :current_login_employee, :current_user, :get_cashier, :order_reservation, :bank_integration end #this is base api base controller to need to inherit. @@ -30,6 +30,38 @@ module LoginVerification @cashier = Employee.where("role = 'cashier' AND token_session <> ''") end + #check order reservation used + def order_reservation + order_reserve = Lookup.collection_of('order_reservation') + status = false + if !order_reserve.empty? + order_reserve.each do |order| + if order[0] == 'OrderReservation' + if order[1] == '1' + status = true + end + end + end + end + return status + end + + #check bank integration used + def bank_integration + bank_integration = Lookup.collection_of('bank_integration') + status = false + if !bank_integration.empty? + bank_integration.each do |bank| + if bank[0] == 'Bank Integration' + if bank[1] == '1' + status = true + end + end + end + end + return status + end + protected # Authenticate the user with token based authentication def authenticate