Skip to content

Commit

Permalink
#145 - Fix Column 'state' in where clause is ambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Aug 24, 2024
1 parent d2eed19 commit 3b42fee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Model/Customer/CustomerChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
namespace Opengento\Gdpr\Model\Customer;

use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Sales\Api\Data\OrderInterface;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
use Opengento\Gdpr\Model\Config\Entity\Erasure as ErasureConfig;
Expand All @@ -21,6 +23,10 @@ public function __construct(
private ErasureConfig $erasureConfig
) {}

/**
* @throws NoSuchEntityException
* @throws LocalizedException
*/
public function canErase(int $entityId): bool
{
$customer = $this->customerRepository->getById($entityId);
Expand Down
2 changes: 1 addition & 1 deletion Model/Order/SourceProvider/GuestFilterModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function apply(AbstractDb $collection, WebsiteInterface $website): void
$collection->addFieldToFilter(OrderInterface::CUSTOMER_ID, ['null' => true]);
$collection->addFieldToFilter(OrderInterface::CUSTOMER_IS_GUEST, ['eq' => 1]);
$collection->addFieldToFilter(
OrderInterface::STATE,
'main_table.' . OrderInterface::STATE,
['in' => $this->erasureConfig->getAllowedStatesToErase($website->getId())]
);
}
Expand Down

0 comments on commit 3b42fee

Please sign in to comment.