diff --git a/Ui/Component/Customer/Form/EraseButton.php b/Ui/Component/Customer/Form/EraseButton.php index 543394b..b35e268 100644 --- a/Ui/Component/Customer/Form/EraseButton.php +++ b/Ui/Component/Customer/Form/EraseButton.php @@ -39,12 +39,11 @@ public function __construct( public function getButtonData(): array { $customerId = $this->getCustomerId(); - $customer = $this->customerRepository->getById($customerId); $buttonData = []; if ($customerId && $this->authorization->isAllowed('Opengento_Gdpr::customer_erase') - && $this->config->isErasureEnabled($customer->getWebsiteId()) + && $this->config->isErasureEnabled($this->customerRepository->getById($customerId)->getWebsiteId()) && $this->eraseCustomerChecker->canCreate($customerId, 'customer') ) { $buttonData = [ diff --git a/Ui/Component/Customer/Form/ExportButton.php b/Ui/Component/Customer/Form/ExportButton.php index fa67918..af3fc20 100644 --- a/Ui/Component/Customer/Form/ExportButton.php +++ b/Ui/Component/Customer/Form/ExportButton.php @@ -31,12 +31,11 @@ public function __construct( public function getButtonData(): array { $customerId = $this->getCustomerId(); - $customer = $this->customerRepository->getById($customerId); $buttonData = []; if ($customerId && $this->authorization->isAllowed('Opengento_Gdpr::customer_export') - && $this->config->isExportEnabled($customer->getWebsiteId())) { + && $this->config->isExportEnabled($this->customerRepository->getById($customerId)->getWebsiteId())) { $buttonData = [ 'label' => new Phrase('Export Personal Data'), 'class' => 'Export',