Skip to content

Commit

Permalink
1.66.0 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Aug 13, 2024
1 parent 547c822 commit c4b9e6a
Show file tree
Hide file tree
Showing 86 changed files with 2,601 additions and 825 deletions.
33 changes: 6 additions & 27 deletions Block/Adminhtml/Amazon/Account/Edit.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
<?php

/**
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

namespace Ess\M2ePro\Block\Adminhtml\Amazon\Account;

use Ess\M2ePro\Block\Adminhtml\Magento\Form\AbstractContainer;

/**
* Class \Ess\M2ePro\Block\Adminhtml\Amazon\Account\Edit
*/
class Edit extends AbstractContainer
{
/** @var \Ess\M2ePro\Helper\Module\Support */
private $supportHelper;
/** @var \Ess\M2ePro\Helper\Data\GlobalData */
private $globalDataHelper;
/** @var \Ess\M2ePro\Helper\Module\Wizard */
private $wizardHelper;

/**
* @param \Ess\M2ePro\Helper\Module\Support $supportHelper
* @param \Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper
* @param \Ess\M2ePro\Helper\Module\Wizard $wizardHelper
* @param \Ess\M2ePro\Block\Adminhtml\Magento\Context\Widget $context
* @param array $data
*/
private \Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper;
private \Ess\M2ePro\Helper\Module\Wizard $wizardHelper;

public function __construct(
\Ess\M2ePro\Helper\Module\Support $supportHelper,
\Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper,
\Ess\M2ePro\Helper\Module\Wizard $wizardHelper,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Widget $context,
array $data = []
) {
$this->supportHelper = $supportHelper;
$this->globalDataHelper = $globalDataHelper;
$this->wizardHelper = $wizardHelper;

parent::__construct($context, $data);
}

Expand Down Expand Up @@ -145,10 +124,10 @@ public function _construct()
}
}

//########################################

protected function _prepareLayout()
{
$this->css->addFile('magento/form/datePicker.css');

$this->jsTranslator->addTranslations([
'is_ready_for_document_generation' => __(
<<<HTML
Expand Down
81 changes: 66 additions & 15 deletions Block/Adminhtml/Amazon/Account/Edit/Tabs/Order.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?php

/**
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

namespace Ess\M2ePro\Block\Adminhtml\Amazon\Account\Edit\Tabs;

use Ess\M2ePro\Block\Adminhtml\Magento\Form\AbstractForm;
Expand Down Expand Up @@ -57,14 +51,6 @@ public function __construct(
parent::__construct($context, $registry, $formFactory, $data);
}

/**
* @param array $formData
* @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
* @param \Ess\M2ePro\Model\Account|null $account
*
* @return void
* @throws \Ess\M2ePro\Model\Exception\Logic
*/
private function addImportTaxRegistrationNumber(
array $formData,
Fieldset $fieldset,
Expand Down Expand Up @@ -120,6 +106,8 @@ protected function _prepareForm()
{
/** @var \Ess\M2ePro\Model\Account|null $account */
$account = $this->globalDataHelper->getValue('edit_account');
/** @var \Ess\M2ePro\Model\Amazon\Account|null $amazonAccount */
$amazonAccount = $account !== null ? $account->getChildObject() : null;

// ---------------------------------------
$websites = $this->storeWebsiteHelper->getWebsites(true);
Expand All @@ -140,7 +128,7 @@ protected function _prepareForm()
$none = ['value' => \Ess\M2ePro\Model\Magento\Product::TAX_CLASS_ID_NONE, 'label' => __('None')];
array_unshift($productTaxClasses, $none);

$formData = $account !== null ? array_merge($account->getData(), $account->getChildObject()->getData()) : [];
$formData = $account !== null ? array_merge($account->getData(), $amazonAccount->getData()) : [];
$formData['magento_orders_settings'] = !empty($formData['magento_orders_settings'])
? \Ess\M2ePro\Helper\Json::decode($formData['magento_orders_settings']) : [];

Expand Down Expand Up @@ -228,6 +216,22 @@ protected function _prepareForm()
]
);

$fieldset->addField(
'magento_orders_listings_create_from_date',
'text',
[
'container_id' => 'magento_orders_listings_create_from_date_container',
'name' => 'magento_orders_settings[listing][create_from_date]',
'label' => __('Create From Date'),
'tooltip' => __(
'Select the start date for channel orders to be created in Magento.'
. ' Orders purchased before this date will not be imported into Magento.'
),
'value' => $this->getMagentoOrdersListingsCreateFromDate($amazonAccount)
->format('Y-m-d H:i:s')
]
);

$fieldset->addField(
'magento_orders_listings_store_mode',
'select',
Expand Down Expand Up @@ -289,6 +293,22 @@ protected function _prepareForm()
]
);

$fieldset->addField(
'magento_orders_listings_other_create_from_date',
'text',
[
'container_id' => 'magento_orders_listings_other_create_from_date_container',
'name' => 'magento_orders_settings[listing_other][create_from_date]',
'label' => __('Create From Date'),
'tooltip' => __(
'Select the start date for channel orders to be created in Magento.'
. ' Orders purchased before this date will not be imported into Magento.'
),
'value' => $this->getMagentoOrdersListingsOtherCreateFromDate($amazonAccount)
->format('Y-m-d H:i:s'),
]
);

$fieldset->addField(
'magento_orders_listings_other_store_id',
self::STORE_SWITCHER,
Expand Down Expand Up @@ -1077,4 +1097,35 @@ protected function _prepareForm()

return parent::_prepareForm();
}

private function getMagentoOrdersListingsCreateFromDate(
?\Ess\M2ePro\Model\Amazon\Account $amazonAccount
): \DateTime {
if ($amazonAccount === null) {
return \Ess\M2ePro\Helper\Date::createCurrentInCurrentZone();
}

return $amazonAccount
->getMagentoOrdersListingsCreateFromDate()
->setTimezone(self::getDateTimeZone());
}

private function getMagentoOrdersListingsOtherCreateFromDate(
?\Ess\M2ePro\Model\Amazon\Account $amazonAccount
): \DateTime {
if ($amazonAccount === null) {
return \Ess\M2ePro\Helper\Date::createCurrentInCurrentZone();
}

return $amazonAccount
->getMagentoOrdersListingsOtherCreateFromDate()
->setTimezone(self::getDateTimeZone());
}

public static function getDateTimeZone(): \DateTimeZone
{
return new \DateTimeZone(
\Ess\M2ePro\Helper\Date::getTimezone()->getConfigTimezone()
);
}
}
30 changes: 30 additions & 0 deletions Block/Adminhtml/Amazon/Listing/AllItems/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ protected function _prepareAdvancedFilters()
$this->addProductTypeAdvancedFilter();

$this->addErrorsAdvancedFilter();
$this->addMagentoProductTypeAdvancedFilter();

parent::_prepareAdvancedFilters();
}
Expand Down Expand Up @@ -1817,4 +1818,33 @@ private function addTaxCodePolicyAdvancedFilter()

$this->addAdvancedFilter($filter);
}

private function addMagentoProductTypeAdvancedFilter(): void
{
$options = $this->advancedFilterAllItemsOptions->getMagentoProductTypeOptions();

if ($options->isEmpty()) {
return;
}

$filterCallback = function (
\Ess\M2ePro\Model\ResourceModel\Magento\Product\Collection $collection,
string $filterValue
): void {
if (empty($filterValue)) {
return;
}

$collection->getSelect()->where('e.type_id = ?', $filterValue);
};

$filter = $this->advancedFilterFactory->createDropDownFilter(
'magento_product_type',
__('Magento Product Type'),
$options,
$filterCallback
);

$this->addAdvancedFilter($filter);
}
}
7 changes: 7 additions & 0 deletions Block/Adminhtml/Ebay/Account/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@ protected function _construct()

$this->addButton('save_buttons', $saveButtons);
}

protected function _prepareLayout()
{
$this->css->addFile('magento/form/datePicker.css');

return parent::_prepareLayout();
}
}
Loading

0 comments on commit c4b9e6a

Please sign in to comment.