From b896e3040984b79596de80ba1f9637e247346bbf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 10 Jun 2023 20:14:20 -0500 Subject: [PATCH] Use new pattern for adding link to view customer in CORE Office --- tailbone_corepos/views/people.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tailbone_corepos/views/people.py b/tailbone_corepos/views/people.py index 9cd6705..f996aef 100644 --- a/tailbone_corepos/views/people.py +++ b/tailbone_corepos/views/people.py @@ -57,13 +57,16 @@ class PersonViewSupplement(ViewSupplement): model = self.model return [model.CorePerson] - def get_customer_xref_buttons(self, person): - buttons = [] - for customer in person.customers: - url = core_office_customer_account_url( - self.rattail_config, customer.number) - buttons.append({'url': url, 'text': "View in CORE Office"}) - return buttons + def get_context_for_customer(self, customer, context): + + if customer.corepos_card_number: + url = core_office_customer_account_url(self.rattail_config, + customer.corepos_card_number) + if url: + context['external_links'].append({'label': "View in CORE Office", + 'url': url}) + + return context def get_member_xref_buttons(self, person): buttons = OrderedDict()