Add "restrict contact info" feature for new custorder batch

also add support for choosing from existing emails
This commit is contained in:
Lance Edgar 2021-10-06 12:32:13 -04:00
parent 9b6113a4c8
commit 0237d8c31a
2 changed files with 102 additions and 47 deletions

View file

@ -255,7 +255,10 @@ class CustomerOrderView(MasterView):
context = {'batch': batch,
'normalized_batch': self.normalize_batch(batch),
'new_order_requires_customer': self.handler.new_order_requires_customer(),
'restrict_contact_info': self.handler.should_restrict_contact_info(),
'contact_display': self.handler.get_contact_display(batch),
'contact_phones': self.handler.get_contact_phones(batch),
'contact_emails': self.handler.get_contact_emails(batch),
'contact_profile_url': None,
'contact_notes': self.handler.get_contact_notes(batch),
'order_items': items,
@ -387,13 +390,19 @@ class CustomerOrderView(MasterView):
except ValueError as error:
return {'error': six.text_type(error)}
self.Session.flush()
context = self.get_context_contact(batch)
context['success'] = True
return context
def get_context_contact(self, batch):
context = {
'success': True,
'customer_uuid': batch.customer_uuid,
'person_uuid': batch.person_uuid,
'phone_number': batch.phone_number,
'email_address': batch.email_address,
'contact_phones': self.handler.get_contact_phones(batch),
'contact_emails': self.handler.get_contact_emails(batch),
'contact_notes': self.handler.get_contact_notes(batch),
}
@ -407,17 +416,9 @@ class CustomerOrderView(MasterView):
def unassign_contact(self, batch, data):
self.handler.unassign_contact(batch)
context = {
'success': True,
'customer_uuid': batch.customer_uuid,
'person_uuid': batch.person_uuid,
'phone_number': batch.phone_number,
'email_address': batch.email_address,
'contact_profile_url': None,
'contact_notes': self.handler.get_contact_notes(batch),
}
self.Session.flush()
context = self.get_context_contact(batch)
context['success'] = True
return context
def update_phone_number(self, batch, data):