diff --git a/rattail/batch/custorder.py b/rattail/batch/custorder.py index b5f404c42167f02484c3024cd55a2695c53f3c8f..55cbdacf8533c8fa52332c7ba56b9cf5b3fba920 100644 --- a/rattail/batch/custorder.py +++ b/rattail/batch/custorder.py @@ -107,7 +107,28 @@ class CustomerOrderBatchHandler(BatchHandler): session = self.app.get_session(batch) session.flush() - session.refresh(batch) + + def get_contact_notes(self, batch): + """ + Get extra "contact notes" which should be made visible to the + user who is entering the new order. + """ + notes = [] + customer_required = self.new_order_requires_customer() + + invalid = False + if customer_required: + if batch.customer: + invalid = [email for email in batch.customer.emails + if email.invalid] + else: + if batch.person: + invalid = [email for email in batch.person.emails + if email.invalid] + if invalid: + notes.append("Customer has one or more invalid email addresses on file.") + + return notes def unassign_contact(self, batch, **kwargs): """