Skip to content

Commit

Permalink
merge develop into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tig-rikjonkmans committed Aug 7, 2018
2 parents c8ba3a8 + 00a24ff commit 4c4e0bf
Show file tree
Hide file tree
Showing 86 changed files with 4,087 additions and 273 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ matrix:
# And there wouldn't be support of PHP 7.1 in Magento 2.0 or 2.1
include:
- php: 7.1
env: MAGENTO_VERSION=2.2.4 CODE_COVERAGE=true
env: MAGENTO_VERSION=2.2.5 CODE_COVERAGE=true

before_script:
- export PATH=$PATH:$HOME/.composer/vendor/bin
Expand Down
5 changes: 5 additions & 0 deletions Api/Data/ShipmentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ public function isGlobalPack();
*/
public function isExtraAtHome();

/**
* @return mixed
*/
public function isIDCheck();

/**
* @return float
*/
Expand Down
56 changes: 56 additions & 0 deletions Block/Adminhtml/Config/Comment/IdCheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
*
* ..::..
* ..::::::::::::..
* ::'''''':''::'''''::
* ::.. ..: : ....::
* :::: ::: : : ::
* :::: ::: : ''' ::
* ::::..:::..::.....::
* ''::::::::::::''
* ''::''
*
*
* NOTICE OF LICENSE
*
* This source file is subject to the Creative Commons License.
* It is available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
*/
namespace TIG\PostNL\Block\Adminhtml\Config\Comment;

use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;
use Magento\Framework\View\Element\Template;

class IdCheck extends Template implements RendererInterface
{
// @codingStandardsIgnoreLine
protected $_template = 'TIG_PostNL::config/comment/idCheck.phtml';

/**
* Render form element as HTML
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
*
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
/** @noinspection PhpUndefinedMethodInspection */
$this->setElement($element);

return $this->toHtml();
}
}
79 changes: 79 additions & 0 deletions Block/Adminhtml/Config/Form/Field/Color.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/**
*
* ..::..
* ..::::::::::::..
* ::'''''':''::'''''::
* ::.. ..: : ....::
* :::: ::: : : ::
* :::: ::: : ''' ::
* ::::..:::..::.....::
* ''::::::::::::''
* ''::''
*
*
* NOTICE OF LICENSE
*
* This source file is subject to the Creative Commons License.
* It is available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
*/
namespace TIG\PostNL\Block\Adminhtml\Config\Form\Field;

use \Magento\Config\Block\System\Config\Form\Field as MagentoField;
use \Magento\Framework\Data\Form\Element\AbstractElement;

class Color extends MagentoField
{
/**
* @param AbstractElement $element
*
* @return string
*/
// @codingStandardsIgnoreLine
protected function _getElementHtml(AbstractElement $element)
{
$html = $element->getElementHtml();
$value = $element->getData('value');
$html .= $this->addColorPickerToHtml($element, $value);

return $html;
}

/**
* @param AbstractElement $element
* @param $value
*
* @return string
*/
private function addColorPickerToHtml(AbstractElement $element, $value)
{
// @codingStandardsIgnoreStart
return '<script type="text/javascript">
require(["jquery","jquery/colorpicker/js/colorpicker"], function ($) {
$(document).ready(function () {
var $el = $("#' . $element->getHtmlId() . '");
$el.css("backgroundColor", "'. $value .'");
$el.ColorPicker({
color: "'. $value .'",
onChange: function (hsb, hex, rgb) {
$el.css("backgroundColor", "#" + hex).val("#" + hex);
}
});
});
});
</script>';
// @codingStandardsIgnoreEnd
}
}
118 changes: 118 additions & 0 deletions Block/Adminhtml/Grid/DataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/**
*
* ..::..
* ..::::::::::::..
* ::'''''':''::'''''::
* ::.. ..: : ....::
* :::: ::: : : ::
* :::: ::: : ''' ::
* ::::..:::..::.....::
* ''::::::::::::''
* ''::''
*
*
* NOTICE OF LICENSE
*
* This source file is subject to the Creative Commons License.
* It is available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
*/
namespace TIG\PostNL\Block\Adminhtml\Grid;

use Magento\Backend\Block\Template;
use Magento\Framework\View\Element\BlockInterface;
use Magento\Framework\App\DeploymentConfig\Reader;
use TIG\PostNL\Config\Source\Options\ProductOptions;
use TIG\PostNL\Config\Provider\ProductOptions as OptionConfig;

class DataProvider extends Template implements BlockInterface
{
/**
* @var string
*/
// @codingStandardsIgnoreLine
protected $_template = 'TIG_PostNL::grid/DataProvider.phtml';

/**
* @var Reader
*/
private $configReader;

/**
* @var ProductOptions
*/
private $productOptions;

/**
* @var OptionConfig
*/
private $optionConfig;

/**
* DataProvider constructor.
*
* @param Template\Context $context
* @param Reader $reader
* @param ProductOptions $productOptions
* @param OptionConfig $optionConfig
* @param array $data
*/
public function __construct(
Template\Context $context,
Reader $reader,
ProductOptions $productOptions,
OptionConfig $optionConfig,
array $data = []
) {
$this->configReader = $reader;
$this->productOptions = $productOptions;
$this->optionConfig = $optionConfig;
parent::__construct($context, $data);
}

/**
* @return string
*/
public function getProductOptions()
{
$this->productOptions->setOptionsBySupportedType();
$supportedTypes = $this->productOptions->get();

$options = [];
foreach ($supportedTypes as $key => $option) {
$options[] = ['value' => (string) $key, 'text' => $option['label']];
}

return \Zend_Json::encode($options);
}

/**
* @return int|string
*/
public function getDefaultProductOption()
{
return $this->optionConfig->getDefaultProductOption();
}

/**
* @return string
*/
public function getAdminBaseUrl()
{
$config = $this->configReader->load();
$adminSuffix = $config['backend']['frontName'];
return $this->getBaseUrl() . $adminSuffix . '/';
}
}
11 changes: 11 additions & 0 deletions Block/Adminhtml/Grid/Order/DownloadPdfAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ public function getConfirmAndPrintLabelsUrl()
return $this->getUrl('postnl/order/CreateShipmentsConfirmAndPrintShippingLabels');
}

/**
* @return string
*/
public function getConfirmAndPrintPackingSlipUrl()
{
return $this->getUrl('postnl/order/CreateShipmentsConfirmAndPrintPackingSlip');
}

/**
* @return string
*/
public function getPrintPackingSlipUrl()
{
return $this->getUrl('postnl/order/CreateShipmentsAndPrintPackingSlip');
}
}
2 changes: 1 addition & 1 deletion Block/Adminhtml/Grid/Shipment/DownloadPdfAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getDownloadUrl()
/**
* @return string
*/
public function getConfirmAndPrintPackingSlipUrl()
public function getPrintPackingSlipUrl()
{
return $this->getUrl('postnl/shipment/massPrintPackingslip');
}
Expand Down
65 changes: 65 additions & 0 deletions Config/Comment/IdCheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/**
*
* ..::..
* ..::::::::::::..
* ::'''''':''::'''''::
* ::.. ..: : ....::
* :::: ::: : : ::
* :::: ::: : ''' ::
* ::::..:::..::.....::
* ''::::::::::::''
* ''::''
*
*
* NOTICE OF LICENSE
*
* This source file is subject to the Creative Commons License.
* It is available through the world-wide-web at this URL:
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
*/
namespace TIG\PostNL\Config\Comment;

use Magento\Config\Model\Config\CommentInterface;
use TIG\PostNL\Block\Adminhtml\Config\Comment\IdCheck as Block;

class IdCheck implements CommentInterface
{
/**
* @var Block
*/
private $block;

/**
* @param Block $block
*/
public function __construct(
Block $block
) {
$this->block = $block;
}

/**
* Retrieve element comment by element value
*
* @param string $elementValue
*
* @return string
*/
// @codingStandardsIgnoreLine
public function getCommentText($elementValue)
{
return $this->block->toHtml();
}
}
Loading

0 comments on commit 4c4e0bf

Please sign in to comment.