Commit 333c6f88 authored by ishan's avatar ishan
Browse files

Merge branch 'Release3.5' into 'inventory'

Solved minor issue in compatibility function

See merge request !231
parents d9810cb2 b94863b9
......@@ -35,11 +35,13 @@ def dbconnect():
def inventoryMigration(con,eng):
metadata.create_all(eng)
print "database created successfully"
con.execute("alter table categorysubcategories add foreign key (subcategoryof) references categorysubcategories(categorycode)")
con.execute("alter table unitofmeasurement add foreign key (subunitof) references unitofmeasurement(uomid)")
con.execute("alter table organisation add column invflag Integer default 0 ")
con.execute("alter table vouchers add column invid Integer")
con.execute("alter table vouchers add foreign key (invid) references invoice(invid)")
con.execute("alter table users add column themename text default 'Default'")
try:
con.execute("select themename from users")
except:
con.execute("alter table users add column themename text default 'Default'")
return 0
......@@ -56,12 +56,11 @@ def gkLogin(request):
"""
try:
con= eng.connect()
dataset = request.json_body
try:
self.con.execute(select([gkdb.organisation.c.invflag]))
con.execute(select([gkdb.organisation.c.invflag]))
except:
inventoryMigration(con,eng)
dataset = request.json_body
result = con.execute(select([gkdb.users.c.userid]).where(and_(gkdb.users.c.username==dataset["username"], gkdb.users.c.userpassword== dataset["userpassword"], gkdb.users.c.orgcode==dataset["orgcode"])) )
if result.rowcount == 1:
record = result.fetchone()
......
......@@ -427,10 +427,6 @@ class api_organisation(object):
userRole = user.fetchone()
dataset = self.request.json_body
if userRole[0]==-1:
metadata.create_all(eng)
print "database created successfully"
self.con.execute("alter table categorysubcategories add foreign key (subcategoryof) references categorysubcategories(categorycode)")
self.con.execute("alter table unitofmeasurement add foreign key (subunitof) references unitofmeasurement(uomid)")
result = self.con.execute(gkdb.organisation.update().where(gkdb.organisation.c.orgcode==authDetails["orgcode"]).values(dataset))
self.con.close()
return {"gkstatus":enumdict["Success"]}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment