|
@@ -362,14 +362,25 @@ class Efactoauth(Anafoauth):
|
|
xml_files = [file for file in files_in_folder if file.lower().endswith('.xml')]
|
|
xml_files = [file for file in files_in_folder if file.lower().endswith('.xml')]
|
|
# print(xml_files)
|
|
# print(xml_files)
|
|
# print(os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml'))
|
|
# print(os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml'))
|
|
- if os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml') not in xml_files \
|
|
|
|
- and os.path.join(dest_f, name[0]).count('_') < 2:
|
|
|
|
- if not os.path.exists(os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml')):
|
|
|
|
- self.xml_inv = self._extract_zipfile(inv_zip, dest_f=dest_f)
|
|
|
|
- # print(self.xml_inv)
|
|
|
|
- # if os.path.exists(self.xml_inv.replace('.xml', '') + '_booked.xml'):
|
|
|
|
- # os.remove(self.xml_inv)
|
|
|
|
- return self.xml_inv
|
|
|
|
|
|
+ if len(xml_files) < 1:
|
|
|
|
+ if os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml') not in xml_files:
|
|
|
|
+ # and os.path.join(dest_f, name[0]).count('_') < 2:
|
|
|
|
+ if not os.path.exists(os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml')):
|
|
|
|
+ self.xml_inv = self._extract_zipfile(inv_zip, dest_f=dest_f)
|
|
|
|
+ # print(self.xml_inv)
|
|
|
|
+ # if os.path.exists(self.xml_inv.replace('.xml', '') + '_booked.xml'):
|
|
|
|
+ # os.remove(self.xml_inv)
|
|
|
|
+ return self.xml_inv
|
|
|
|
+ else:
|
|
|
|
+ for file in xml_files:
|
|
|
|
+ if name[0].replace('.xml', '') not in file and file.count('_') < 2:
|
|
|
|
+ if not os.path.exists(os.path.join(dest_f, name[0].replace('.xml', '') + '_booked.xml')):
|
|
|
|
+ self.xml_inv = self._extract_zipfile(inv_zip, dest_f=dest_f)
|
|
|
|
+ # print(self.xml_inv)
|
|
|
|
+ # if os.path.exists(self.xml_inv.replace('.xml', '') + '_booked.xml'):
|
|
|
|
+ # os.remove(self.xml_inv)
|
|
|
|
+ return self.xml_inv
|
|
|
|
+
|
|
else:
|
|
else:
|
|
inv_zip = ZipFile(io.BytesIO(self.zip_inv), mode='r')
|
|
inv_zip = ZipFile(io.BytesIO(self.zip_inv), mode='r')
|
|
name = [name for name in inv_zip.namelist() if 'semnatura' not in name]
|
|
name = [name for name in inv_zip.namelist() if 'semnatura' not in name]
|