fixed conflict after merge with dev
This commit is contained in:
@@ -56,7 +56,7 @@ module LicenseVerification
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
puts "RUN SAY BYAR"
|
||||
Rails.logger.info "License successed"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ module LoginVerification
|
||||
|
||||
def current_shop
|
||||
begin
|
||||
shop_code ='263'
|
||||
shop_code ='262'
|
||||
@shop =Shop.find_by_shop_code(shop_code)
|
||||
return @shop
|
||||
rescue
|
||||
@@ -42,7 +42,7 @@ module LoginVerification
|
||||
|
||||
#Shop Name in Navbor
|
||||
def shop_detail
|
||||
shop_code ='263'
|
||||
shop_code ='262'
|
||||
@shop = Shop.find_by_shop_code(shop_code)
|
||||
return @shop
|
||||
end
|
||||
@@ -91,7 +91,7 @@ module LoginVerification
|
||||
#@current_user = User.find_by(api_key: token)
|
||||
#Rails.logger.debug "token - " + token.to_s
|
||||
|
||||
@user =Employee.authenticate_by_token(token,current_shop)
|
||||
@user = Employee.authenticate_by_token(token,current_shop)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
|
||||
@@ -3,40 +3,43 @@ module NumberFormattable
|
||||
|
||||
def precision
|
||||
@precision ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'precision'}
|
||||
if @precision
|
||||
@precision.value.to_i
|
||||
else
|
||||
if @precision.nil?
|
||||
@print_settings ||= PrintSetting.get_precision_delimiter
|
||||
if @print_settings
|
||||
@print_settings.precision.to_i
|
||||
@precision = OpenStruct.new(value: @print_settings.precision.to_i)
|
||||
else
|
||||
@precision = OpenStruct.new(value: 2)
|
||||
end
|
||||
end || 2
|
||||
end
|
||||
@precison_value ||= @precision.value.to_i
|
||||
end
|
||||
|
||||
def delimiter
|
||||
@delimiter ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'delimiter'}
|
||||
if @delimiter
|
||||
@delimiter_value ||= @delimiter.value.to_s.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") }
|
||||
else
|
||||
if @delimiter.nil?
|
||||
@print_settings ||= PrintSetting.get_precision_delimiter
|
||||
if @print_settings
|
||||
"," if @print_settings.delimiter
|
||||
if @print_settings && @print_settings.delimiter
|
||||
@delimiter = OpenStruct.new(value: ",")
|
||||
else
|
||||
@delimiter = OpenStruct.new(value: "")
|
||||
end
|
||||
end || ""
|
||||
end
|
||||
@delimiter_value ||= @delimiter.value.to_s.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") }
|
||||
end
|
||||
|
||||
def strip_insignificant_zeros
|
||||
@strip_insignificant_zeros ||= Lookup.number_formats.find { |f| f.name.parameterize.underscore == 'strip_insignificant_zeros'}
|
||||
if @strip_insignificant_zeros
|
||||
['1', 't', 'true', 'on', 'y', 'yes'].include? @strip_insignificant_zeros.value.to_s
|
||||
end || false
|
||||
if @strip_insignificant_zeros.nil?
|
||||
@strip_insignificant_zeros = OpenStruct.new(value: false)
|
||||
end
|
||||
@strip_insignificant_zeros_value ||= ['1', 't', 'true', 'on', 'y', 'yes'].include? @strip_insignificant_zeros.value.to_s
|
||||
end
|
||||
|
||||
def number_format(number, options = {})
|
||||
options[:precision] = options[:precision] || precision
|
||||
# options[:delimiter] = options[:delimiter] || delimiter
|
||||
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
||||
|
||||
|
||||
if options[:precision] > 0
|
||||
if options[:strip_insignificant_zeros]
|
||||
formatted = "%.12g" % number.round(options[:precision])
|
||||
@@ -44,10 +47,10 @@ module NumberFormattable
|
||||
formatted = "%.#{options[:precision]}f" % number.round(options[:precision])
|
||||
end
|
||||
else
|
||||
formatted = number.to_i.to_s
|
||||
formatted = number.round(options[:precision]).to_i.to_s
|
||||
end
|
||||
|
||||
if options[:delimiter] &&
|
||||
|
||||
if options[:delimiter] && !options[:delimiter].empty?
|
||||
formatted = formatted.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, "\\1#{options[:delimiter]}")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user