Skip to content

Commit

Permalink
Merge pull request #1110 from plentymarkets/fix/notexisting_configvalue
Browse files Browse the repository at this point in the history
FIX: remove config value
  • Loading branch information
stentrop authored Jun 29, 2022
2 parents 575b0de + c701a65 commit 73859be
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions src/Services/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,31 +281,23 @@ public function findOrderById(int $orderId, $wrap = true)
*/
public function findOrderByAccessKey($orderId, $orderAccessKey)
{
/**
* @var TemplateConfigService $templateConfigService
*/
$templateConfigService = pluginApp(TemplateConfigService::class);
$redirectToLogin = $templateConfigService->getBoolean('my_account.confirmation_link_login_redirect');

$order = $this->orderRepository->findOrderByAccessKey($orderId, $orderAccessKey);

if ($redirectToLogin) {
$orderContactId = 0;
foreach ($order->relations as $relation) {
if ($relation['referenceType'] == 'contact' && (int)$relation['referenceId'] > 0) {
$orderContactId = $relation['referenceId'];
}
$orderContactId = 0;
foreach ($order->relations as $relation) {
if ($relation['referenceType'] == 'contact' && (int)$relation['referenceId'] > 0) {
$orderContactId = $relation['referenceId'];
}
}

if ((int)$orderContactId > 0) {
if ((int)$this->contactRepository->getContactId() <= 0) {
/** @var ShopUrls $shopUrls */
$shopUrls = pluginApp(ShopUrls::class);
$backlink = $this->getConfirmationUrl($shopUrls->confirmation, $orderId, $orderAccessKey);
AuthGuard::redirect($shopUrls->login . '?backlink=' . $backlink);
} elseif ((int)$orderContactId !== (int)$this->contactRepository->getContactId()) {
return null;
}
if ((int)$orderContactId > 0) {
if ((int)$this->contactRepository->getContactId() <= 0) {
/** @var ShopUrls $shopUrls */
$shopUrls = pluginApp(ShopUrls::class);
$backlink = $this->getConfirmationUrl($shopUrls->confirmation, $orderId, $orderAccessKey);
AuthGuard::redirect($shopUrls->login . '?backlink=' . $backlink);
} elseif ((int)$orderContactId !== (int)$this->contactRepository->getContactId()) {
return null;
}
}
return LocalizedOrder::wrap($order, Utils::getLang());
Expand Down

0 comments on commit 73859be

Please sign in to comment.