You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
466 B
Lua
24 lines
466 B
Lua
local order = {}
|
|
|
|
order.setdb = function(db)
|
|
order.db = db
|
|
end
|
|
|
|
order.new = function(t)
|
|
local order_record = {}
|
|
order_record.type = 'order'
|
|
order_record.cart_id = t.cart.id
|
|
order_record.user_id = t.cart.user_id
|
|
order_record.date_ordered = os.time()
|
|
order_record.status = 'open'
|
|
order_record.progress = 'ordered'
|
|
|
|
order.db:insertrecord(order_record)
|
|
|
|
t.cart.order_id = order_record.id
|
|
t.cart:save()
|
|
|
|
return order_record
|
|
end
|
|
|
|
return order |