Skip to content

[BUG] Order states mixed with order statuses #153

Open
@mkobierzynski

Description

@mkobierzynski

Description

Config "Allowed Order States to Erase" suggests you're about to choose order states that would be allowed to be erased, but source model of this config Opengento\Gdpr\Model\Config\Source\OrderPendingStates really returns order statuses list. That is misleading.

But real issue is config setting is compared with states in couple of places, which leads to unexpected results. For me this was: despite marking all statuses as allowed to be erased, new orders would never be erased, as there is new state, but there's no new status.

    public function toOptionArray(): array
    {
        return $this->options ??= $this->collectionFactory->create()->joinStates()->toOptionArray();
    }
    public function toOptionArray()
    {
        return $this->_toOptionArray('status', 'label');
    }
    public function canErase(int $entityId): bool
    {
        $order = $this->orderRepository->get($entityId);

        return in_array($order->getState(), $this->allowedStates($order), true);
    }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions