Object contact logic implemented
This commit is contained in:
@@ -6,7 +6,7 @@ from ..PyqcrmFlags import PyqcrmAppliEmpyFlags
|
||||
|
||||
|
||||
class ObjectDAO(QObject):
|
||||
newObjectAdded = Signal(bool)
|
||||
newObjectAdded = Signal(bool, int)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -15,12 +15,17 @@ class ObjectDAO(QObject):
|
||||
if self.__con:
|
||||
self.__cur = self.__con.cursor()
|
||||
|
||||
def addObject(self, new_object, new_objcontact, enc_key):
|
||||
def addObject(self, new_object):
|
||||
try:
|
||||
if self.__cur:
|
||||
self.__cur.callproc("addObject", (json.dumps(new_object), json.dumps(new_objcontact), enc_key,))
|
||||
self.__cur.callproc("addObject", (json.dumps(new_object),))
|
||||
self.__con.commit()
|
||||
self.newObjectAdded.emit(True)
|
||||
self.__cur.callproc("getLastInsertId")
|
||||
object_id = self.__cur.fetchone()
|
||||
self.newObjectAdded.emit(True, object_id[0])
|
||||
return object_id[0]
|
||||
else:
|
||||
return None
|
||||
except mariadb.Error as e:
|
||||
self.newObjectAdded.emit(False)
|
||||
print(str(e))
|
||||
|
||||
Reference in New Issue
Block a user