Skip to content

Commit 9f81304

Browse files
Revert "#29752: Stores are not shown in "Login as Customer: Select Store" modal window on order view page"
This reverts commit 4787c82
1 parent 4787c82 commit 9f81304

File tree

1 file changed

+2
-69
lines changed
  • app/code/Magento/LoginAsCustomerAdminUi/Ui/Customer/Component/ConfirmationPopup

1 file changed

+2
-69
lines changed

app/code/Magento/LoginAsCustomerAdminUi/Ui/Customer/Component/ConfirmationPopup/Options.php

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@
1010
use Magento\Customer\Api\CustomerRepositoryInterface;
1111
use Magento\Customer\Api\Data\CustomerInterface;
1212
use Magento\Customer\Model\Config\Share;
13-
use Magento\Framework\App\ObjectManager;
1413
use Magento\Framework\App\RequestInterface;
1514
use Magento\Framework\Data\OptionSourceInterface;
1615
use Magento\Framework\Escaper;
17-
use Magento\Sales\Api\CreditmemoRepositoryInterface;
18-
use Magento\Sales\Api\InvoiceRepositoryInterface;
19-
use Magento\Sales\Api\OrderRepositoryInterface;
20-
use Magento\Sales\Api\ShipmentRepositoryInterface;
2116
use Magento\Store\Model\Group;
2217
use Magento\Store\Model\System\Store as SystemStore;
2318
use Magento\Store\Model\Website;
@@ -57,61 +52,25 @@ class Options implements OptionSourceInterface
5752
*/
5853
private $options;
5954

60-
/**
61-
* @var OrderRepositoryInterface
62-
*/
63-
private $orderRepository;
64-
65-
/**
66-
* @var InvoiceRepositoryInterface
67-
*/
68-
private $invoiceRepository;
69-
70-
/**
71-
* @var ShipmentRepositoryInterface
72-
*/
73-
private $shipmentRepository;
74-
75-
/**
76-
* @var CreditmemoRepositoryInterface
77-
*/
78-
private $creditmemoRepository;
79-
8055
/**
8156
* @param CustomerRepositoryInterface $customerRepository
8257
* @param Escaper $escaper
8358
* @param RequestInterface $request
8459
* @param Share $share
8560
* @param SystemStore $systemStore
86-
* @param OrderRepositoryInterface|null $orderRepository
87-
* @param InvoiceRepositoryInterface|null $invoiceRepository
88-
* @param ShipmentRepositoryInterface|null $shipmentRepository
89-
* @param CreditmemoRepositoryInterface|null $creditmemoRepository
9061
*/
9162
public function __construct(
9263
CustomerRepositoryInterface $customerRepository,
9364
Escaper $escaper,
9465
RequestInterface $request,
9566
Share $share,
96-
SystemStore $systemStore,
97-
?OrderRepositoryInterface $orderRepository = null,
98-
?InvoiceRepositoryInterface $invoiceRepository = null,
99-
?ShipmentRepositoryInterface $shipmentRepository = null,
100-
?CreditmemoRepositoryInterface $creditmemoRepository = null
67+
SystemStore $systemStore
10168
) {
10269
$this->customerRepository = $customerRepository;
10370
$this->escaper = $escaper;
10471
$this->request = $request;
10572
$this->share = $share;
10673
$this->systemStore = $systemStore;
107-
$this->orderRepository = $orderRepository
108-
?? ObjectManager::getInstance()->get(OrderRepositoryInterface::class);
109-
$this->invoiceRepository = $invoiceRepository
110-
?? ObjectManager::getInstance()->get(InvoiceRepositoryInterface::class);
111-
$this->shipmentRepository = $shipmentRepository
112-
?? ObjectManager::getInstance()->get(ShipmentRepositoryInterface::class);
113-
$this->creditmemoRepository = $creditmemoRepository
114-
?? ObjectManager::getInstance()->get(CreditmemoRepositoryInterface::class);
11574
}
11675

11776
/**
@@ -123,7 +82,7 @@ public function toOptionArray(): array
12382
return $this->options;
12483
}
12584

126-
$customerId = $this->getCustomerId();
85+
$customerId = (int)$this->request->getParam('id');
12786
$this->options = $this->generateCurrentOptions($customerId);
12887

12988
return $this->options;
@@ -208,30 +167,4 @@ private function fillStoreGroupOptions(Website $website, CustomerInterface $cust
208167

209168
return $groups;
210169
}
211-
212-
/**
213-
* Get Customer id from request param.
214-
*
215-
* @return int
216-
*/
217-
private function getCustomerId(): int
218-
{
219-
$customerId = $this->request->getParam('id');
220-
if (!$customerId) {
221-
$orderId = $this->request->getParam('order_id');
222-
$shipmentId = $this->request->getParam('shipment_id');
223-
$creditmemoId = $this->request->getParam('creditmemo_id');
224-
$invoiceId = $this->request->getParam('invoice_id');
225-
if ($invoiceId) {
226-
$orderId = $this->invoiceRepository->get($invoiceId)->getOrderId();
227-
} elseif ($shipmentId) {
228-
$orderId = $this->shipmentRepository->get($shipmentId)->getOrderId();
229-
} elseif ($creditmemoId) {
230-
$orderId = $this->creditmemoRepository->get($creditmemoId)->getOrderId();
231-
}
232-
$customerId = $this->orderRepository->get($orderId)->getCustomerId();
233-
}
234-
235-
return (int)$customerId;
236-
}
237170
}

0 commit comments

Comments
 (0)