This commit is contained in:
2024-12-16 08:57:25 +01:00
3 changed files with 10 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ class BusinessDAO(QObject):
self.__cur = self.__con.cursor()
def getBusiness(self, enc_key, criterion = "Alle"):
if self.__cur:
self.__cur.callproc("getCustomerView", (enc_key, criterion,))

View File

@@ -68,22 +68,23 @@ class BusinessModel(QAbstractTableModel):
def __init__(self):
super().__init__()
# <<<<<<< HEAD
self.__business_dao = BusinessDAO()
self.__business_dao.newBusinessAdded.connect(self.__refreshView)
self.__conf = ConfigLoader().getConfig()
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
# =======
# self.__key = ConfigLoader().getKey()
# >>>>>>> e28c68f (AddCustomer, AddContact finished)
self.__getData()
def __getData(self, criterion = "Alle"):
self.beginResetModel()
rows, self.__visible_columns = self.__business_dao.getBusiness(self.__key, criterion)
self.__data = rows
self.endResetModel()
@@ -134,6 +135,7 @@ class BusinessModel(QAbstractTableModel):
@Slot(dict, int)
def addBusiness(self, business, contact_id):
BusinessDAO().addBusiness(self.__key, business, contact_id)
@Slot()

View File

@@ -10,6 +10,7 @@ class ContactModel(QObject):
# print(f"*** File: {__file__}, __init__()")
#self.logger = logging.getLogger()
self.__conf = ConfigLoader().getConfig()
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
@@ -30,7 +31,9 @@ class ContactModel(QObject):
@Slot(dict)
def addContact(self, contact):
i = ContactDAO().addContact(contact, self.__key)
self.contactIdReady.emit(i)