contact-person-profile-csv-imp-local 0.0.20__py3-none-any.whl → 0.0.21__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py +32 -14
- {contact_person_profile_csv_imp_local-0.0.20.dist-info → contact_person_profile_csv_imp_local-0.0.21.dist-info}/METADATA +1 -1
- {contact_person_profile_csv_imp_local-0.0.20.dist-info → contact_person_profile_csv_imp_local-0.0.21.dist-info}/RECORD +5 -5
- {contact_person_profile_csv_imp_local-0.0.20.dist-info → contact_person_profile_csv_imp_local-0.0.21.dist-info}/WHEEL +0 -0
- {contact_person_profile_csv_imp_local-0.0.20.dist-info → contact_person_profile_csv_imp_local-0.0.21.dist-info}/top_level.txt +0 -0
|
@@ -19,6 +19,7 @@ from database_mysql_local.generic_crud import GenericCRUD
|
|
|
19
19
|
from contact_user_external_local.contact_user_external_local import ContactUserExternalLocal
|
|
20
20
|
from contact_profile_local.contact_profiles_local import ContactProfilesLocal
|
|
21
21
|
from contact_phone_local.contact_phone_local import ContactPhoneLocal
|
|
22
|
+
from phones_local.phones_local import PhonesLocal
|
|
22
23
|
from contact_persons_local.contact_persons_local import ContactPersonsLocal
|
|
23
24
|
from contact_notes_local.contact_notes_local import ContactNotesLocal
|
|
24
25
|
from contact_location_local.contact_location_local import ContactLocationLocal
|
|
@@ -341,6 +342,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
341
342
|
|
|
342
343
|
def __insert_contact_details_to_db(self, *, contact_id: int, contact_dict: dict, user_external_id: int,
|
|
343
344
|
data_source_instance_id: int, data_source_type_id: int) -> int:
|
|
345
|
+
|
|
346
|
+
location_id = DEFAULT_LOCATION_ID
|
|
344
347
|
# insert organization
|
|
345
348
|
organization_id = self.__insert_organization(contact_dict=contact_dict)
|
|
346
349
|
|
|
@@ -363,9 +366,9 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
363
366
|
|
|
364
367
|
# insert link contact_profiles
|
|
365
368
|
contact_profile_info = self.__insert_contact_profiles(
|
|
366
|
-
contact_dict=contact_dict, contact_id=contact_id) or {}
|
|
369
|
+
contact_dict=contact_dict, contact_id=contact_id, person_id=person_id) or {}
|
|
367
370
|
|
|
368
|
-
profile_id = contact_profile_info.get("profile_id")
|
|
371
|
+
profile_id = contact_profile_info.get("profile_id")
|
|
369
372
|
|
|
370
373
|
# insert organization-profile
|
|
371
374
|
self.__insert_organization_profile(
|
|
@@ -373,7 +376,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
373
376
|
|
|
374
377
|
# insert link contact_email_addresses
|
|
375
378
|
self.__insert_link_contact_email_addresses(
|
|
376
|
-
contact_dict=contact_dict, contact_id=contact_id)
|
|
379
|
+
contact_dict=contact_dict, contact_id=contact_id, person_id=person_id, profile_id=profile_id)
|
|
377
380
|
|
|
378
381
|
# insert link contact_notes
|
|
379
382
|
self.__insert_link_contact_notes_and_text_blocks(
|
|
@@ -448,7 +451,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
448
451
|
def __insert_organization_profile(self, organization_id: int, profile_id: int) -> int or None:
|
|
449
452
|
|
|
450
453
|
if not organization_id or not profile_id:
|
|
451
|
-
return
|
|
454
|
+
return None
|
|
452
455
|
|
|
453
456
|
organization_profile_id = self.organization_profiles.insert_mapping_if_not_exists(
|
|
454
457
|
organization_id=organization_id, profile_id=profile_id)
|
|
@@ -470,19 +473,25 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
470
473
|
return groups_linked
|
|
471
474
|
|
|
472
475
|
def __insert_link_contact_persons(self, contact_dict: dict, contact_id: int) -> dict:
|
|
476
|
+
phones_local = PhonesLocal(is_test_data=self.is_test_data)
|
|
477
|
+
contact_phone_number = contact_dict.get("phone1")
|
|
478
|
+
if contact_phone_number:
|
|
479
|
+
result_dict = phones_local.normalize_phone_number(original_number=contact_phone_number, region=None)
|
|
480
|
+
if result_dict:
|
|
481
|
+
contact_normalized_phone_number = result_dict.get("full_number_normalized")
|
|
482
|
+
else:
|
|
483
|
+
contact_normalized_phone_number = None
|
|
473
484
|
contact_person_results_dict = self.contact_persons.insert_contact_and_link_to_existing_or_new_person(
|
|
474
485
|
contact_dict=contact_dict,
|
|
475
486
|
contact_email_address=contact_dict["email1"],
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
# TODO: what about phone2 etc?
|
|
487
|
+
contact_normalized_phone_number=contact_normalized_phone_number,
|
|
488
|
+
contact_id=contact_id
|
|
479
489
|
)
|
|
480
|
-
# contact_person_id = contact_person_results_dict.get("contact_person_id")
|
|
481
490
|
|
|
482
491
|
return contact_person_results_dict
|
|
483
492
|
|
|
484
|
-
def __insert_link_contact_email_addresses(self, contact_dict, contact_id
|
|
485
|
-
|
|
493
|
+
def __insert_link_contact_email_addresses(self, contact_dict: dict, contact_id: int, person_id: int = None,
|
|
494
|
+
profile_id: int = None) -> list[int]:
|
|
486
495
|
email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
|
|
487
496
|
contact_dict=contact_dict)
|
|
488
497
|
contact_email_addresses = self.contact_email_addresses
|
|
@@ -491,7 +500,9 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
491
500
|
contact_email_address_id = contact_email_addresses.insert_contact_and_link_to_email_address(
|
|
492
501
|
contact_dict=contact_dict,
|
|
493
502
|
contact_email_address_str=email_address,
|
|
494
|
-
contact_id=contact_id
|
|
503
|
+
contact_id=contact_id,
|
|
504
|
+
person_id=person_id,
|
|
505
|
+
profile_id=profile_id
|
|
495
506
|
)
|
|
496
507
|
contact_email_address_ids.append(contact_email_address_id)
|
|
497
508
|
|
|
@@ -503,6 +514,9 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
503
514
|
if not contact_dict.get("notes"):
|
|
504
515
|
return
|
|
505
516
|
# TODO: I think we should change ContactNotesLocal - send the args to the method and not the class
|
|
517
|
+
if profile_id is None:
|
|
518
|
+
# TODO: check if this method works with profile_id = None
|
|
519
|
+
profile_id = DEFAULT_PROFILE_ID
|
|
506
520
|
contact_notes = ContactNotesLocal(
|
|
507
521
|
contact_dict=contact_dict, contact_id=contact_id, profile_id=profile_id)
|
|
508
522
|
insert_information = contact_notes.insert_contact_notes_text_block()
|
|
@@ -511,7 +525,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
511
525
|
|
|
512
526
|
def __insert_link_contact_phones(self, contact_dict: dict, contact_id: int, profile_id: int, person_id: int,
|
|
513
527
|
location_id: int, country_id: int) -> list[int]:
|
|
514
|
-
|
|
528
|
+
if location_id == DEFAULT_LOCATION_ID:
|
|
529
|
+
location_id = None
|
|
515
530
|
phone_numbers = self.contacts_local.get_contact_phone_numbers_from_contact_dict(
|
|
516
531
|
contact_dict=contact_dict)
|
|
517
532
|
contact_phone_ids = []
|
|
@@ -540,10 +555,13 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
540
555
|
|
|
541
556
|
return contact_user_external_id
|
|
542
557
|
|
|
543
|
-
def __insert_contact_profiles(self, contact_dict: dict, contact_id: int) -> dict:
|
|
558
|
+
def __insert_contact_profiles(self, contact_dict: dict, contact_id: int, person_id: int = None) -> dict:
|
|
544
559
|
|
|
545
560
|
insert_information = self.contact_profiles.insert_and_link_contact_profile(
|
|
546
|
-
contact_dict=contact_dict,
|
|
561
|
+
contact_dict=contact_dict,
|
|
562
|
+
contact_id=contact_id,
|
|
563
|
+
person_id=person_id
|
|
564
|
+
)
|
|
547
565
|
|
|
548
566
|
return insert_information
|
|
549
567
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.21
|
|
4
4
|
Summary: PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/contact-person-profile-csv-imp-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=
|
|
1
|
+
contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=ClFAP6ntBayUJuH-k4dgJkrml8-Wy55E4mJc3a0YHeg,41424
|
|
2
2
|
contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=eE0Bg2dCPrmG72K20k0_KOckc61C9cGSgH0Zgae_lbk,957
|
|
4
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
5
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
6
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
7
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
4
|
+
contact_person_profile_csv_imp_local-0.0.21.dist-info/METADATA,sha256=2yl92Bd2snQzELayCR4qIbBIMPypqqU4PvZy5EBXAUM,1450
|
|
5
|
+
contact_person_profile_csv_imp_local-0.0.21.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
6
|
+
contact_person_profile_csv_imp_local-0.0.21.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
|
|
7
|
+
contact_person_profile_csv_imp_local-0.0.21.dist-info/RECORD,,
|
|
File without changes
|