Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_material_ui
This commit is contained in:
@@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
@@ -35,18 +35,31 @@ class ApplicationController < ActionController::Base
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
else
|
||||
# check for license file
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, key)
|
||||
@license = License.new(url, key)
|
||||
def current_license(url)
|
||||
@license = License.new(url)
|
||||
|
||||
##creating md5 hash
|
||||
md5_hostname = Digest::MD5.new
|
||||
md5key = md5_hostname.update(request.host)
|
||||
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||
#if (@license.detail == true)
|
||||
if (@license.detail_with_local_file() == true)
|
||||
puts "RUN SAY BYAR"
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def cache_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
# Export for Key
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_key(lookup)
|
||||
|
||||
if (@license.detail_with_local_cache(lookup, aes_key, aes_iv) == true)
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
@@ -93,8 +106,10 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
private
|
||||
def check_installation
|
||||
if current_company.nil?
|
||||
def check_license
|
||||
if License.check_license_file
|
||||
return true
|
||||
else
|
||||
redirect_to install_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,42 @@
|
||||
class InstallController < BaseController
|
||||
def index
|
||||
end
|
||||
|
||||
def index
|
||||
def create
|
||||
restaurant = params[:restaurant_name]
|
||||
license_key = params[:license_key]
|
||||
admin_user = params[:admin_user]
|
||||
admin_password = params[:admin_password]
|
||||
end
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
||||
if (!@license.nil?)
|
||||
# logger.info "Location - " + @license.name
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||
else
|
||||
# reconnect_default_db
|
||||
logger.info 'License is nil'
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
def current_license(url, key)
|
||||
@license = License.new(url, key)
|
||||
|
||||
##creating md5 hash
|
||||
md5_hostname = Digest::MD5.new
|
||||
md5key = md5_hostname.update(request.host)
|
||||
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
||||
#if (@license.detail == true)
|
||||
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,9 +16,9 @@ class Settings::DiningChargesController < ApplicationController
|
||||
# GET /dining_charges/new
|
||||
def new
|
||||
@dining_charge = DiningCharge.new
|
||||
@dining_charge.minimum_free_time="00:30"
|
||||
@dining_charge.charge_block="02:00"
|
||||
@dining_charge.time_rounding_block="00:15"
|
||||
@dining_charge.minimum_free_time = "00:15:00".to_datetime
|
||||
@dining_charge.charge_block= "01:00:00".to_datetime
|
||||
@dining_charge.time_rounding_block="00:15:00".to_datetime
|
||||
end
|
||||
|
||||
# GET /dining_charges/1/edit
|
||||
@@ -27,15 +27,19 @@ class Settings::DiningChargesController < ApplicationController
|
||||
|
||||
# POST /dining_charges
|
||||
# POST /dining_charges.json
|
||||
def create
|
||||
def create
|
||||
@dining_charge = DiningCharge.new(dining_charge_params)
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
@dining_charge.minimum_free_time = DateTime.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = DateTime.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = DateTime.parse(dining_charge_params["time_rounding_block"])
|
||||
|
||||
respond_to do |format|
|
||||
if @dining_charge.save
|
||||
if @table
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
format.html { redirect_to settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
format.html { redirect_to settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully created.' }
|
||||
end
|
||||
format.json { render :show, status: :created, location: @dining_charge }
|
||||
else
|
||||
@@ -50,15 +54,18 @@ class Settings::DiningChargesController < ApplicationController
|
||||
def update
|
||||
respond_to do |format|
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
@dining_charge.minimum_free_time = DateTime.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = DateTime.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = DateTime.parse(dining_charge_params["time_rounding_block"])
|
||||
if @dining_charge.update(dining_charge_params)
|
||||
# @dining_charge.minimum_free_time = @dining_charge.minimum_free_time.to_datetime.advance(hours: +6, minutes: +30)
|
||||
# @dining_charge.charge_block = @dining_charge.charge_block.to_datetime.advance(hours: +6, minutes: +30)
|
||||
# @dining_charge.time_rounding_block = @dining_charge.time_rounding_block.to_datetime.advance(hours: +6, minutes: +30)
|
||||
# @dining_charge.save
|
||||
if @table
|
||||
format.html { redirect_to edit_settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
format.html { redirect_to settings_zone_table_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
else
|
||||
format.html { redirect_to edit_settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
format.html { redirect_to settings_zone_room_path(@zone,@settings_dining_facility), notice: 'Dining charge was successfully updated.' }
|
||||
end
|
||||
format.json { render :show, status: :ok, location: @dining_charge }
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user