edit ticket controller
This commit is contained in:
@@ -24,13 +24,12 @@ class BatchLineItem < ApplicationRecord
|
||||
find_lookup=Lookup.find_by_name('generate_serial_no')
|
||||
if !find_lookup.nil?
|
||||
max_value=find_lookup.max_value
|
||||
max_value=max_value +1
|
||||
prefix=find_lookup.prefix
|
||||
max_length=find_lookup.max_length
|
||||
|
||||
max_value=max_value +1
|
||||
max_length=find_lookup.max_length
|
||||
sufix_len=max_length-prefix.length
|
||||
sufix_str="0" * sufix_len
|
||||
|
||||
value_len= max_value.to_s.length
|
||||
start=0
|
||||
ends=sufix_len-value_len-1
|
||||
sufix_str= sufix_str[start..ends]
|
||||
@@ -38,14 +37,7 @@ class BatchLineItem < ApplicationRecord
|
||||
prefix_str=prefix.to_s + user_id.to_s
|
||||
|
||||
serial_no=prefix_str.to_s+sufix_str+max_value.to_s
|
||||
return serial_no
|
||||
else
|
||||
lookup= Lookup.new
|
||||
lookup.name="generate_serial_no"
|
||||
lookup.max_value=0
|
||||
lookup.prefix='0000'
|
||||
lookup.max_length=16
|
||||
lookup.save
|
||||
return serial_no
|
||||
end
|
||||
end
|
||||
def self.to_csv(user_id)
|
||||
@@ -68,7 +60,7 @@ class BatchLineItem < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
def self.encrypted(message,encrypt_key)
|
||||
def self.encrypted(message,encrypt_key)
|
||||
cipher = OpenSSL::Cipher::Cipher.new("aes-128-cbc")
|
||||
cipher.encrypt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user