From 5adbc7755535a08777b92fe1719550875ed0086e Mon Sep 17 00:00:00 2001 From: Ambulance Clerc Date: Fri, 16 Jun 2023 19:43:34 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9bug=20de=20la=20feature=20adresse=5Flivr?= =?UTF-8?q?aison?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class_invoices.py | 22 +++++++++++++++------- custom_popup.py | 8 ++++---- dl_version | 2 +- main.py | 5 +++-- version.py | 2 +- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/class_invoices.py b/class_invoices.py index d1d1101..7c2a148 100644 --- a/class_invoices.py +++ b/class_invoices.py @@ -25,36 +25,44 @@ class cls_Invoice: if debitor["name"] is not None: concat_str += con + debitor["name"] # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" if debitor["gender"] is not None: concat_str += con + "Monsieur" if debitor["gender"] == "Masculin" else con + "Madame" # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" if debitor["lastname"] is not None: concat_str += con + self.ifNotNull(debitor["lastname"]) + " " + self.ifNotNull( debitor["firstname"]) # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" if debitor["complement"] is not None: concat_str += con + debitor["complement"] # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" if debitor["street"] is not None: concat_str += con + self.ifNotNull(debitor["street"]) + " " + self.ifNotNull( debitor["street_number"]) # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" if debitor["city"] is not None: concat_str += con + self.ifNotNull(debitor["postal_code"]) + " " + self.ifNotNull( debitor["city"]) # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" if debitor["country_name"] != "Suisse": concat_str += con + debitor["country_name"] # con = "#chr(13)##chr(10)#" - con = "\r\n" + con = "\n" self.Patient["addr_2"] = concat_str + self.Patient["selfish"] = self.is_addr_2_selfish(self.Patient) + def is_addr_2_selfish(self, patient): + print(patient) + temp_addr_2 = str(patient["addr_2"]).replace("Monsieur","").replace("Madame","").replace("\n","").replace(" ","") + str_compare = patient['lastname'].replace('.','') + patient['firstname'].replace('.','') + self.ifNotNull(patient['complement']).strip()+ patient['street'].strip() + patient['street_number'].strip() + patient['postal_code'].strip() + patient['city'].strip() + str_compare = str_compare.replace(" ","") + print(f"is_addr_2_selfish ? {str_compare} <> {temp_addr_2} = {str_compare == temp_addr_2}") + return str_compare == temp_addr_2 def ifNotNull(self, value, ret=""): if value == None or value == "None": return ret diff --git a/custom_popup.py b/custom_popup.py index ad32b64..900649b 100644 --- a/custom_popup.py +++ b/custom_popup.py @@ -46,8 +46,8 @@ class Check_addresses_popup(Toplevel): self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="NPA/Localité:", str1=f"{item_1['postal_code']} {item_1['city']}", str2=f"{item_2.npa} {item_2.city}") - - self.add_compares_element(new_frame=lbf_addr_2_new, old_frame=lbf_addr_2_old, label="Adresse livraison:", str1=item_1["addr_2"], + if int(debitor["code"]) < 100: + self.add_compares_element(new_frame=lbf_addr_2_new, old_frame=lbf_addr_2_old, label="Adresse livraison:", str1=item_1["addr_2"], str2=self.ifNotNull(item_2.addr_2)) @@ -114,9 +114,9 @@ class Check_addresses_popup(Toplevel): con = "*" Label(new_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W") - Label(new_frame, text=con + str(str1) + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W") + Label(new_frame, text=con + str(str1) + con, fg=value_color, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W") Label(old_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W") - Label(old_frame, text=con + str(str2) + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W") + Label(old_frame, text=con + str(str2) + con, fg=value_color, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W") self.x_row += 1 diff --git a/dl_version b/dl_version index e1b87c3..4cf2aa0 100644 --- a/dl_version +++ b/dl_version @@ -1 +1 @@ -20230616-1729 \ No newline at end of file +20230616-1943 \ No newline at end of file diff --git a/main.py b/main.py index 15d66dd..f8fdc4e 100644 --- a/main.py +++ b/main.py @@ -303,7 +303,7 @@ class ClercAttrib2Biz(): o_addresse.street_cpl =str( record["AD_RUE_1"]) o_addresse.npa =str( record["AD_NPA"]) o_addresse.city = str(record["AD_VILLE"]) - o_addresse.addr_2 = str(record["AD_ADR2"]) + o_addresse.addr_2 = str(record["AD_ADR2"]).replace("\r\n","\n") self.addresses.add_addresse(o_addresse) logging.warning(f"Chargement du fichier adresses.dbf terminé ! {len(self.addresses.items)} adresses trouvées ") else: @@ -412,11 +412,12 @@ class ClercAttrib2Biz(): return False if f"{new['postal_code']} {new['city']}" != f"{old.npa} {old.city}": return False - if new["addr_2"] != old.addr_2: + if new["addr_2"] != old.addr_2 and not new["selfish"]: return False return True + def parseFile(self, data, filename): self.progress_bar["value"] = 0 self.index_counter += 1 diff --git a/version.py b/version.py index 547eba8..edbf6b0 100644 --- a/version.py +++ b/version.py @@ -1 +1 @@ -VERSION = "20230616-1729" \ No newline at end of file +VERSION = "20230616-1943" \ No newline at end of file