More tweaks for CORE <-> Rattail member sync
This commit is contained in:
parent
788efbd114
commit
3cef682a75
|
@ -135,7 +135,7 @@ class MemberImporter(FromRattail, corepos_importing.model.MemberImporter):
|
||||||
'customerID': str(shopper.corepos_customer_id),
|
'customerID': str(shopper.corepos_customer_id),
|
||||||
'firstName': person.first_name,
|
'firstName': person.first_name,
|
||||||
'lastName': person.last_name,
|
'lastName': person.last_name,
|
||||||
'accountHolder': shopper.shopper_number == 1,
|
'accountHolder': 1 if shopper.shopper_number == 1 else 0,
|
||||||
'phone': phone1.number if phone1 else '',
|
'phone': phone1.number if phone1 else '',
|
||||||
'altPhone': phone2.number if phone2 else '',
|
'altPhone': phone2.number if phone2 else '',
|
||||||
'email': email.address if email else '',
|
'email': email.address if email else '',
|
||||||
|
@ -160,11 +160,11 @@ class MemberImporter(FromRattail, corepos_importing.model.MemberImporter):
|
||||||
return {
|
return {
|
||||||
'cardNo': customer.number,
|
'cardNo': customer.number,
|
||||||
'customerAccountID': str(customer.corepos_account_id or ''),
|
'customerAccountID': str(customer.corepos_account_id or ''),
|
||||||
'addressFirstLine': address.street if address else '',
|
'addressFirstLine': (address.street or '') if address else '',
|
||||||
'addressSecondLine': (address.street2 or '') if address else '',
|
'addressSecondLine': (address.street2 or '') if address else '',
|
||||||
'city': address.city if address else '',
|
'city': (address.city or '') if address else '',
|
||||||
'state': address.state if address else '',
|
'state': (address.state or '') if address else '',
|
||||||
'zip': address.zipcode if address else '',
|
'zip': (address.zipcode or '') if address else '',
|
||||||
'startDate': start_date,
|
'startDate': start_date,
|
||||||
'endDate': end_date,
|
'endDate': end_date,
|
||||||
'customers': shoppers,
|
'customers': shoppers,
|
||||||
|
|
|
@ -132,6 +132,9 @@ class CoreCustomerShopper(model.Base):
|
||||||
cascade='all, delete-orphan',
|
cascade='all, delete-orphan',
|
||||||
cascade_backrefs=False))
|
cascade_backrefs=False))
|
||||||
|
|
||||||
|
# please note, there is *not* a unique constraint on this field.
|
||||||
|
# that is intentional, for now, to give some breathing room for
|
||||||
|
# testing etc.
|
||||||
corepos_customer_id = sa.Column(sa.Integer(), nullable=True, doc="""
|
corepos_customer_id = sa.Column(sa.Integer(), nullable=True, doc="""
|
||||||
``Customers.customerID`` value for this shopper, within CORE-POS.
|
``Customers.customerID`` value for this shopper, within CORE-POS.
|
||||||
""")
|
""")
|
||||||
|
|
|
@ -845,12 +845,14 @@ class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter):
|
||||||
card_number, member)
|
card_number, member)
|
||||||
return
|
return
|
||||||
|
|
||||||
if member['memberStatus'] in self.non_member_status_codes:
|
# TODO: at first i was *skipping* non-member status records,
|
||||||
log.debug("skipping non-member %s with status '%s': %s",
|
# but since CORE sort of assumes all customers are members,
|
||||||
member['memberStatus'], card_number, member)
|
# probably not worth making the distinction here..? it is
|
||||||
return
|
# important to import the full member info from CORE, so that
|
||||||
if member['memberStatus'] not in self.member_status_codes:
|
# we have it to sync back. therefore can't afford to "skip"
|
||||||
# note that we will still import this one! we don't skip it
|
# any member records here
|
||||||
|
if (member['memberStatus'] not in self.member_status_codes
|
||||||
|
and member['memberStatus'] not in self.non_member_status_codes):
|
||||||
log.warning("unexpected status '%s' for member %s: %s",
|
log.warning("unexpected status '%s' for member %s: %s",
|
||||||
member['memberStatus'], card_number, member)
|
member['memberStatus'], card_number, member)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue