remove conflict data

This commit is contained in:
phyusin
2018-02-27 14:35:21 +06:30
49 changed files with 1989 additions and 363 deletions

View File

@@ -1,60 +1,25 @@
class ApplicationController < ActionController::Base
include LicenseVerification
include LoginVerification
#before_action :check_installation
protect_from_forgery with: :exception
# lookup domain for db from provision
before_action :set_locale
helper_method :current_company,:current_login_employee,:current_user,:shop_detail
# before_action :set_locale
# helper_method :current_company,:current_login_employee,:current_user
# alias_method :current_user, :current_login_employee,:current_user
#this is base api base controller to need to inherit.
#all token authentication must be done here
#response format must be set to JSON
#change locallization
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
# RESTful url for localize
def default_url_options
{ locale: I18n.locale }
end
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
redirect_to root_path
end
def current_user
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
end
# Get current Cashier
def get_cashier
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
end
def current_company
begin
return Company.first
rescue
return nil
end
end
def shop_detail
@shop = Shop.first
end
def current_login_employee
if (!session[:session_token].nil?)
@employee = Employee.find_by_token_session(session[:session_token])
end
end
end