Object contact logic implemented

This commit is contained in:
2025-03-12 09:50:06 +01:00
parent 767200096f
commit e3053be72e
8 changed files with 95 additions and 43 deletions

View File

@@ -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))