Skip to content

Commit

Permalink
Merge pull request #85 from magmodules/1.4.13
Browse files Browse the repository at this point in the history
1.4.13
  • Loading branch information
Marvin-Magmodules authored Jan 6, 2020
2 parents 64c399a + 7cc4e70 commit b9c59f8
Show file tree
Hide file tree
Showing 11 changed files with 504 additions and 206 deletions.
33 changes: 0 additions & 33 deletions Helper/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Order extends AbstractHelper
const XPATH_INVOICE_ORDER = 'magmodules_channable_marketplace/order/invoice_order';
const XPATH_USE_CUSTOM_STATUS = 'magmodules_channable_marketplace/order/use_custom_status';
const XPATH_CUSTOM_STATUS = 'magmodules_channable_marketplace/order/custom_status';
const XPATH_SEPERATE_HOUSENUMBER = 'magmodules_channable_marketplace/order/seperate_housenumber';
const XPATH_SHIPPING_METHOD = 'magmodules_channable_marketplace/order/shipping_method';
const XPATH_SHIPPING_CUSTOM = 'magmodules_channable_marketplace/order/shipping_method_custom';
const XPATH_SHIPPING_METHOD_FALLBACK = 'magmodules_channable_marketplace/order/shipping_method_fallback';
Expand All @@ -38,12 +37,10 @@ class Order extends AbstractHelper
const XPATH_LVB_AUTO_SHIP = 'magmodules_channable_marketplace/order/lvb_ship';
const XPATH_ORDERID_PREFIX = 'magmodules_channable_marketplace/order/orderid_prefix';
const XPATH_ORDERID_ALPHANUMERIC = 'magmodules_channable_marketplace/order/orderid_alphanumeric';
const XPATH_IMPORT_COMPANY_NAME = 'magmodules_channable_marketplace/order/import_company_name';
const XPATH_LOG = 'magmodules_channable_marketplace/order/log';
const XPATH_TAX_PRICE = 'tax/calculation/price_includes_tax';
const XPATH_TAX_SHIPPING = 'tax/calculation/shipping_includes_tax';
const XPATH_SHIPPING_TAX_CLASS = 'tax/classes/shipping_tax_class';
const XPATH_CUSTOMER_STREET_LINES = 'customer/address/street_lines';

/**
* @var General
Expand Down Expand Up @@ -307,36 +304,6 @@ public function getLvbAutoShip($storeId = null)
return $this->generalHelper->getStoreValue(self::XPATH_LVB_AUTO_SHIP, $storeId);
}

/**
* @param null $storeId
*
* @return int
*/
public function getSeperateHousenumber($storeId = null)
{
return $this->generalHelper->getStoreValue(self::XPATH_SEPERATE_HOUSENUMBER, $storeId);
}

/**
* @param $storeId
*
* @return int
*/
public function getCustomerStreetLines($storeId)
{
return (int) $this->generalHelper->getStoreValue(self::XPATH_CUSTOMER_STREET_LINES, $storeId);
}

/**
* @param $storeId
*
* @return bool
*/
public function importCompanyName($storeId)
{
return (bool)$this->generalHelper->getStoreValue(self::XPATH_IMPORT_COMPANY_NAME, $storeId);
}

/**
* @param $channelId
* @param $storeId
Expand Down
124 changes: 124 additions & 0 deletions Model/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?php
/**
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magmodules\Channable\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

class Config
{

const XPATH_USE_CUSTOM_STATUS = 'magmodules_channable_marketplace/order/use_custom_status';
const XPATH_CUSTOM_STATUS = 'magmodules_channable_marketplace/order/custom_status';
const XPATH_SEND_INVOICE = 'magmodules_channable_marketplace/order/invoice_order_email';
const XPATH_IMPORT_CUSTOMER = 'magmodules_channable_marketplace/order/import_customer';
const XPATH_IMPORT_COMPANY_NAME = 'magmodules_channable_marketplace/order/import_company_name';
const XPATH_SEPERATE_HOUSENUMBER = 'magmodules_channable_marketplace/order/seperate_housenumber';
const XPATH_CUSTOMER_STREET_LINES = 'customer/address/street_lines';

/**
* @var ScopeConfigInterface
*/
private $config;

/**
* Config constructor.
*
* @param ScopeConfigInterface $config
*/
public function __construct(
ScopeConfigInterface $config
) {
$this->config = $config;
}

/**
* @param null $storeId
*
* @return mixed
*/
public function processingStatus($storeId = null)
{
if (!$this->getPath(self::XPATH_USE_CUSTOM_STATUS, $storeId)) {
return null;
}

return $this->getPath(self::XPATH_CUSTOM_STATUS, $storeId);
}

/**
* @param $storeId
*
* @return bool
*/
public function sendInvoiceEmail($storeId)
{
return $this->getFlag(self::XPATH_SEND_INVOICE, $storeId);
}

/**
* @param null $storeId
*
* @return bool
*/
public function importCompanyName($storeId = null)
{
return $this->getFlag(self::XPATH_IMPORT_COMPANY_NAME, $storeId);
}

/**
* @param null|int $storeId
*
* @return mixed
*/
public function importCustomer($storeId = null)
{
return $this->getFlag(self::XPATH_IMPORT_CUSTOMER, $storeId);
}

/**
* @param null|int $storeId
*
* @return int
*/
public function getSeperateHousenumber($storeId = null)
{
return $this->getFlag(self::XPATH_SEPERATE_HOUSENUMBER, $storeId);
}

/**
* @param null|int $storeId
*
* @return int
*/
public function getCustomerStreetLines($storeId)
{
return (int) $this->getPath(self::XPATH_CUSTOMER_STREET_LINES, $storeId);
}

/**
* @param $path
* @param $storeId
*
* @return string
*/
private function getPath($path, $storeId)
{
return $this->config->getValue($path, ScopeInterface::SCOPE_STORE, $storeId);
}

/**
* @param $path
* @param $storeId
*
* @return bool
*/
private function getFlag($path, $storeId)
{
return $this->config->isSetFlag($path, ScopeInterface::SCOPE_STORE, $storeId);
}
}
Loading

0 comments on commit b9c59f8

Please sign in to comment.