Skip to content

Commit 4f299aa

Browse files
committed
Merged PR 6146: Merge release/244 to master
Related work items: #57864, #58400, #62374, #62500, #62502, #62529, #62545, #62568, #62569, #62576, #63053, #63306, #63521, #63852, #63854, #63995, #64072, #64113, #64426, #64429, #64470, #64486, #65062, #65183, #65245, #65261, #65297, #65347
2 parents 1601ade + 7040621 commit 4f299aa

File tree

48 files changed

+1825
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1825
-188
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace Dotdigitalgroup\Email\Block\Adminhtml\Config\Developer;
4+
5+
class EmailTemplatesSync extends \Magento\Config\Block\System\Config\Form\Field
6+
{
7+
8+
/**
9+
* @var string
10+
*/
11+
public $buttonLabel = 'Run Now';
12+
13+
/**
14+
* @param string $buttonLabel
15+
*
16+
* @return $this
17+
*/
18+
public function setButtonLabel($buttonLabel)
19+
{
20+
$this->buttonLabel = $buttonLabel;
21+
22+
return $this;
23+
}
24+
25+
/**
26+
* Get the button and scripts contents.
27+
*
28+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
29+
*
30+
* @return string
31+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
32+
*/
33+
public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
34+
{
35+
$url = $this->_urlBuilder->getUrl('dotdigitalgroup_email/run/templatesync');
36+
37+
return $this->getLayout()
38+
->createBlock(\Magento\Backend\Block\Widget\Button::class)
39+
->setType('button')
40+
->setLabel($this->buttonLabel)
41+
->setOnClick("window.location.href='" . $url . "'")
42+
->toHtml();
43+
}
44+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace Dotdigitalgroup\Email\Block\Adminhtml\Config\Developer;
4+
5+
class Templatesync extends \Magento\Config\Block\System\Config\Form\Field
6+
{
7+
8+
/**
9+
* @var string
10+
*/
11+
public $buttonLabel = 'Run Now';
12+
13+
/**
14+
* @param string $buttonLabel
15+
*
16+
* @return $this
17+
*/
18+
public function setButtonLabel($buttonLabel)
19+
{
20+
$this->buttonLabel = $buttonLabel;
21+
22+
return $this;
23+
}
24+
25+
/**
26+
* Get the button and scripts contents.
27+
*
28+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
29+
*
30+
* @return string
31+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
32+
*/
33+
public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
34+
{
35+
$url = $this->_urlBuilder->getUrl('dotdigitalgroup_email/run/templatesync');
36+
37+
return $this->getLayout()
38+
->createBlock(\Magento\Backend\Block\Widget\Button::class)
39+
->setType('button')
40+
->setLabel($this->buttonLabel)
41+
->setOnClick("window.location.href='" . $url . "'")
42+
->toHtml();
43+
}
44+
}

Block/Adminhtml/Studio.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ public function generateToken()
151151
if ($refreshToken) {
152152
$accessToken = $this->client->getAccessToken(
153153
$this->configFactory->getTokenUrl(),
154-
$this->buildUrlParams($refreshToken)
154+
$this->buildUrlParams(
155+
$this->helper->encryptor->decrypt($refreshToken)
156+
)
155157
);
156158

157159
if (is_string($accessToken)) {

Block/Customer/Account/Books.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ public function _getApiClient()
8888
if (empty($this->client)) {
8989
$website = $this->getCustomer()->getStore()->getWebsite();
9090
$client = $this->helper->getWebsiteApiClient($website);
91-
$client->setApiUsername($this->helper->getApiUsername($website))
92-
->setApiPassword($this->helper->getApiPassword($website));
9391
$this->client = $client;
9492
}
9593

Controller/Adminhtml/Abandoned/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function execute()
4848
$resultPage->setActiveMenu('Dotdigitalgroup_Email::abandoned');
4949
$resultPage->addBreadcrumb(__('Abandoned'), __('Abandoned'));
5050
$resultPage->addBreadcrumb(__('Reports'), __('Reports'));
51-
$resultPage->getConfig()->getTitle()->prepend(__('Abandoned Report'));
51+
$resultPage->getConfig()->getTitle()->prepend(__('Abandoned Cart Report'));
5252

5353
return $resultPage;
5454
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace Dotdigitalgroup\Email\Controller\Adminhtml\Run;
4+
5+
class Templatesync extends \Magento\Backend\App\AbstractAction
6+
{
7+
/**
8+
* @var \Dotdigitalgroup\Email\Model\Email\TemplateFactory
9+
*/
10+
private $emailTemplatesFactory;
11+
12+
/**
13+
* @var \Magento\Framework\Message\ManagerInterface
14+
*/
15+
protected $messageManager;
16+
17+
18+
/**
19+
* Templatesync constructor.
20+
*
21+
* @param \Dotdigitalgroup\Email\Model\Email\TemplateFactory $templateFactory
22+
* @param \Magento\Backend\App\Action\Context $context
23+
*/
24+
public function __construct(
25+
\Dotdigitalgroup\Email\Model\Email\TemplateFactory $templateFactory,
26+
\Magento\Backend\App\Action\Context $context
27+
) {
28+
$this->emailTemplatesFactory = $templateFactory;
29+
$this->messageManager = $context->getMessageManager();
30+
parent::__construct($context);
31+
}
32+
33+
/**
34+
*
35+
* @return null
36+
*/
37+
public function execute()
38+
{
39+
//run sync
40+
$result = $this->emailTemplatesFactory->create()
41+
->sync();
42+
43+
//add sync message
44+
if (isset($result['message'])) {
45+
$this->messageManager->addSuccessMessage($result['message']);
46+
}
47+
48+
$redirectBack = $this->_redirect->getRefererUrl();
49+
$this->_redirect($redirectBack);
50+
}
51+
52+
/**
53+
* @return bool
54+
*/
55+
protected function _isAllowed()
56+
{
57+
return $this->_authorization->isAllowed('Dotdigitalgroup_Email::config');
58+
}
59+
}

Controller/Customer/Newsletter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public function execute()
6161
//if enabled
6262
if ($this->helper->isEnabled($website)) {
6363
$client = $this->helper->getWebsiteApiClient($website);
64-
$client->setApiUsername($this->helper->getApiUsername($website))
65-
->setApiPassword($this->helper->getApiPassword($website));
6664

6765
$contact = $client->getContactById($customerId);
6866
if (isset($contact->id)) {

Controller/Email/Callback.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ public function execute()
124124
$this->helper->error('OAUTH failed ' . $response->error, []);
125125
} elseif (isset($response->refresh_token)) {
126126
//save the refresh token to the admin user
127-
$adminUser->setRefreshToken($response->refresh_token);
127+
$adminUser->setRefreshToken(
128+
$this->helper->encryptor->encrypt($response->refresh_token)
129+
);
128130

129131
$this->userResource->save($adminUser);
130132
}

Controller/Email/Getbasket.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,31 @@ class Getbasket extends \Magento\Framework\App\Action\Action
2424
*/
2525
private $quote;
2626

27+
/**
28+
* @var \Magento\Customer\Model\SessionFactory
29+
*/
30+
private $customerSessionFactory;
31+
2732
/**
2833
* Getbasket constructor.
2934
*
3035
* @param \Magento\Quote\Model\ResourceModel\Quote $quoteResource
3136
* @param \Magento\Checkout\Model\SessionFactory $checkoutSessionFactory
3237
* @param \Magento\Quote\Model\QuoteFactory $quoteFactory
3338
* @param \Magento\Framework\App\Action\Context $context
39+
* @param \Magento\Customer\Model\SessionFactory $customerSessionFactory
3440
*/
3541
public function __construct(
3642
\Magento\Quote\Model\ResourceModel\Quote $quoteResource,
3743
\Magento\Checkout\Model\SessionFactory $checkoutSessionFactory,
3844
\Magento\Quote\Model\QuoteFactory $quoteFactory,
39-
\Magento\Framework\App\Action\Context $context
45+
\Magento\Framework\App\Action\Context $context,
46+
\Magento\Customer\Model\SessionFactory $customerSessionFactory
4047
) {
4148
$this->checkoutSession = $checkoutSessionFactory;
4249
$this->quoteFactory = $quoteFactory;
4350
$this->quoteResource = $quoteResource;
51+
$this->customerSessionFactory = $customerSessionFactory;
4452
parent::__construct($context);
4553
}
4654

@@ -85,7 +93,7 @@ public function execute()
8593
private function handleCustomerBasket()
8694
{
8795
/** @var \Magento\Customer\Model\Session $customerSession */
88-
$customerSession = $this->checkoutSession->create();
96+
$customerSession = $this->customerSessionFactory->create();
8997
$configCartUrl = $this->quote->getStore()->getWebsite()->getConfig(
9098
\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CONTENT_CART_URL
9199
);

Helper/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class Config extends \Magento\Framework\App\Helper\AbstractHelper
227227
const XML_PATH_CONNECTOR_CLIENT_SECRET_ID = 'connector_developer_settings/oauth/client_key';
228228
const XML_PATH_CONNECTOR_CUSTOM_AUTHORIZATION = 'connector_developer_settings/oauth/custom_authorization';
229229
const XML_PATH_CONNECTOR_ADVANCED_DEBUG_ENABLED = 'connector_developer_settings/debug/debug_enabled';
230-
const XML_PATH_CONNECTOR_DEBUG_API_REQUEST_LIMIT = 'connector_developer_settings/debug/api_request_time_limit';
230+
const XML_PATH_CONNECTOR_DEBUG_API_REQUEST_LIMIT = 'connector_developer_settings/debug/api_log_time';
231231
const XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT =
232232
'connector_developer_settings/import_settings/transactional_data';
233233
const XML_PATH_CONNECTOR_IP_RESTRICTION_ADDRESSES = 'connector_developer_settings/ip_restriction/ip_addresses';

0 commit comments

Comments
 (0)