A lot of changes going on
This commit is contained in:
@@ -14,11 +14,11 @@ class AddressDAO:
|
||||
|
||||
|
||||
|
||||
|
||||
def __importPlz(self):
|
||||
with open("pfad zur datei", "r") as plz:
|
||||
with open("/home/dstoppek/Coden/Projekte/pyqcrm/doc/postleitzahl.json", "r") as plz:
|
||||
postcodes = json.load(plz)
|
||||
irgendwas = ""
|
||||
country = "Deutschland"
|
||||
|
||||
try:
|
||||
for i in postcodes:
|
||||
test =i["plz_name"].split(",")
|
||||
@@ -28,8 +28,8 @@ class AddressDAO:
|
||||
town = town.strip()
|
||||
if town:
|
||||
print(f"PROCESSING {i['name']} {town}")
|
||||
self.__cur.callproc("addZipCodes", (i["name"], town, irgendwas,))
|
||||
#self.__cur.callproc("addZipCodes", ("56271", "Kleinmaischeid", irgendwas,))
|
||||
self.__cur.callproc("importLocation", (country, town, i["name"],))
|
||||
|
||||
except mariadb.OperationalError as e:
|
||||
print(f"Database Error: {e}")
|
||||
finally:
|
||||
@@ -37,7 +37,7 @@ class AddressDAO:
|
||||
print("FINISHED")#
|
||||
|
||||
def __importCountry(self):
|
||||
with open("pfad zur datei", "r") as country:
|
||||
with open("/home/dstoppek/Coden/Projekte/pyqcrm/doc/staaten.json", "r") as country:
|
||||
countries = json.load(country)
|
||||
old = ""
|
||||
try:
|
||||
@@ -78,3 +78,4 @@ class AddressDAO:
|
||||
print(str(e))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ class AddressModel(QAbstractListModel):
|
||||
def data(self, index, role = Qt.DisplayRole):
|
||||
row = index.row()
|
||||
if role == Qt.DisplayRole:
|
||||
data = self.__address_data[row][2]
|
||||
data = self.__address_data[row][5]
|
||||
return data
|
||||
elif role == PyqcrmDataRoles.CITY_ROLE:
|
||||
data = self.__address_data[row][3]
|
||||
data = self.__address_data[row][4]
|
||||
return data
|
||||
return None
|
||||
|
||||
|
||||
@@ -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,14 +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))
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, Signal
|
||||
from .ObjectDAO import ObjectDAO
|
||||
from ..ConfigLoader import ConfigLoader
|
||||
from ..PyqcrmDataRoles import PyqcrmDataRoles
|
||||
import re
|
||||
import json
|
||||
|
||||
@@ -66,8 +67,16 @@ class ObjectModel(QAbstractTableModel):
|
||||
if object_col > 4 and tr:
|
||||
tr = re.sub("Keine Angabe ","", tr)
|
||||
return tr
|
||||
elif role == PyqcrmDataRoles.STREET_IN_POSTCODE:
|
||||
pass
|
||||
return None
|
||||
|
||||
def roleNames(self):
|
||||
return {
|
||||
Qt.DisplayRole: b"display",
|
||||
PyqcrmDataRoles.STREET_IN_POSTCODE: b"StreetInPostcode",
|
||||
}
|
||||
|
||||
def headerData(self, section, orientation, role = Qt.DisplayRole):
|
||||
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
||||
self.__col_name = self.__visible_columns[section + self.__col_skip]
|
||||
|
||||
@@ -5,5 +5,6 @@ from enum import IntEnum
|
||||
|
||||
class PyqcrmDataRoles(IntEnum):
|
||||
CITY_ROLE = Qt.UserRole + 100
|
||||
STREET_IN_POSTCODE = CITY_ROLE + 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user