Detect bad memtype number early, for CORE API -> Rattail import
to avoid false diffs when we give a bad value
This commit is contained in:
parent
2cf865d879
commit
86a8e2d241
|
@ -846,11 +846,20 @@ class MemberImporter(FromCOREPOSAPI, corepos_importing.model.MemberImporter):
|
|||
'%Y-%m-%d %H:%M:%S')
|
||||
withdrew = withdrew.date()
|
||||
|
||||
typeno = int(member['customerTypeID']) or None
|
||||
if typeno:
|
||||
memtype = self.get_membership_type_by_number(typeno)
|
||||
if not memtype:
|
||||
logger = log.warning if self.get_warn_for_unknown_membership_type() else log.debug
|
||||
logger("unknown customerTypeID (membership_type_number) %s for: %s",
|
||||
member['customerTypeID'], member)
|
||||
typeno = None
|
||||
|
||||
return {
|
||||
'number': card_number,
|
||||
'customer_uuid': customer.uuid,
|
||||
'person_uuid': person.uuid,
|
||||
'membership_type_number': int(member['customerTypeID']),
|
||||
'membership_type_number': typeno,
|
||||
'joined': joined,
|
||||
'withdrew': withdrew,
|
||||
'active': not bool(withdrew),
|
||||
|
|
Loading…
Reference in a new issue