Add Customer/Object/Employee working - DEBUGGING anchor Errors done
This commit is contained in:
@@ -75,7 +75,7 @@ class BusinessModel(QAbstractTableModel):
|
||||
self.__business_dao.newBusinessAdded.connect(self.__refreshView)
|
||||
self.__conf = ConfigLoader().getConfig()
|
||||
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
|
||||
# self.__getData()
|
||||
self.__getData()
|
||||
|
||||
def __getData(self, criterion = "Alle"):
|
||||
self.beginResetModel()
|
||||
|
||||
@@ -50,15 +50,15 @@ class ContactDAO(QObject):
|
||||
self.newObjectContactAdded.emit(False)
|
||||
|
||||
def getContact(self, contact_id, enc_key = None):
|
||||
# try:
|
||||
# if self.__cur:
|
||||
# self.__cur.callproc("getCustomerContact", (contact_id, enc_key,))
|
||||
# #self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
# return self.__cur.fetchall() #, self.__all_cols
|
||||
# else:
|
||||
# return None #, None
|
||||
# except mariadb.Error as e:
|
||||
# print(str(e))
|
||||
pass
|
||||
try:
|
||||
if self.__cur:
|
||||
self.__cur.callproc("getCustomerContact", (contact_id, enc_key,))
|
||||
#self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
return self.__cur.fetchall() #, self.__all_cols
|
||||
else:
|
||||
return None #, None
|
||||
except mariadb.Error as e:
|
||||
print(str(e))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import json
|
||||
|
||||
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal, QJsonDocument
|
||||
from PySide6.QtQml import QJSValue
|
||||
|
||||
from PySide6.QtQml import QJSValue, QJSValueIterator
|
||||
from .EmployeeDAO import EmployeeDAO
|
||||
# from ..PyqcrmFlags import PyqcrmFlags, PyqcrmAppliEmpyFlags
|
||||
from ..ConfigLoader import ConfigLoader
|
||||
@@ -35,20 +33,31 @@ class EmployeeModel(QAbstractTableModel):
|
||||
self.__employee_dao.addEmployee(new_employee, self.__key, False)
|
||||
|
||||
@Slot(QJSValue)
|
||||
def addApplicant(self, applicant: QJSValue):
|
||||
self.__employee_dao.addEmployee({
|
||||
"city": applicant.property("city").toString(),
|
||||
"email": applicant.property("email").toString(),
|
||||
"firstname": applicant.property("firstname").toString(),
|
||||
"formofaddress": applicant.property("formofaddress").toString(),
|
||||
"houseno": applicant.property("houseno").toString(),
|
||||
"lastname": applicant.property("lastname").toString(),
|
||||
"mobile": applicant.property("mobile").toString(),
|
||||
"phone": applicant.property("phone").toString(),
|
||||
"postcode": applicant.property("postcode").toInt(),
|
||||
"street": applicant.property("street").toString(),
|
||||
"title": applicant.property("title").toString(),
|
||||
}, self.__key, True)
|
||||
def addApplicant(self, new_applicant):
|
||||
data = {}
|
||||
it = QJSValueIterator(new_applicant)
|
||||
while it.hasNext():
|
||||
it.next()
|
||||
if "function" in it.value().toString() or "objectName" == it.name():
|
||||
continue
|
||||
data[it.name()] = it.value().toString()
|
||||
self.__employee_dao.addEmployee(data, self.__key)
|
||||
|
||||
# @Slot(QJSValue)
|
||||
# def addApplicant(self, applicant: QJSValue):
|
||||
# self.__employee_dao.addEmployee({
|
||||
# "city": applicant.property("city").toString(),
|
||||
# "email": applicant.property("email").toString(),
|
||||
# "firstname": applicant.property("firstname").toString(),
|
||||
# "formofaddress": applicant.property("formofaddress").toString(),
|
||||
# "houseno": applicant.property("houseno").toString(),
|
||||
# "lastname": applicant.property("lastname").toString(),
|
||||
# "mobile": applicant.property("mobile").toString(),
|
||||
# "phone": applicant.property("phone").toString(),
|
||||
# "postcode": applicant.property("postcode").toInt(),
|
||||
# "street": applicant.property("street").toString(),
|
||||
# "title": applicant.property("title").toString(),
|
||||
# }, self.__key, True)
|
||||
|
||||
@Slot(bool)
|
||||
def __refreshView(self, added):
|
||||
|
||||
Reference in New Issue
Block a user