Fix adding a contact person to an object and db autocommit

This commit is contained in:
2025-03-12 15:43:13 +01:00
parent 898d808b1f
commit 773d398f8c
9 changed files with 64 additions and 48 deletions

View File

@@ -22,8 +22,13 @@ class ContactDAO(QObject):
if self.__cur:
self.__cur.callproc("addContactPerson", (enc_key, json.dumps(contact),))
self.__con.commit()
self.__cur.callproc("getLastInsertId")
contact_id = self.__cur.fetchone()
self.__cur.callproc("logger",(contact_id[0], "INSERT", "addContactPerson: New Contact added",))
self.__con.commit()
return contact_id[0]
else:
return None
except mariadb.Error as e:
print("MDB: " + str(e))
except Exception as e:
@@ -36,7 +41,7 @@ class ContactDAO(QObject):
self.__con.commit()
self.__cur.callproc("logObjectContact")
self.__con.commit()
self.newObjectContactAdded.emit(True)
# self.newObjectContactAdded.emit(True)
except mariadb.Error as e:
print("MDB (addObjectContact): " + str(e))
self.newObjectContactAdded.emit(False)