Skip to content

Commit

Permalink
Merge pull request postnl#215 from tig-nl/develop
Browse files Browse the repository at this point in the history
v1.7.4-alpha
  • Loading branch information
tig-daanvandenbergh authored Mar 27, 2019
2 parents 5b2d4e3 + aa2fe50 commit bc880dd
Show file tree
Hide file tree
Showing 32 changed files with 573 additions and 585 deletions.
8 changes: 7 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Issues with outdated version will be rejected.

---

### If your issue contains security sensitive information
** If your issue may contain sensitive information, please send us an e-mail at security@tig.nl.**
- [ ] This issue does not contain any security sensitive information

---

### If the purpose of your issue is a *feature request*
- As a *..certain type of user..* I’d like to *..describe what you want..* in order to *..write goal(s)..*
- Suggestions and background:
Expand All @@ -40,4 +46,4 @@ Issues with outdated version will be rejected.
### TIG support

- Please ask your question in English to ensure that your issue can help other people internationally. Nevertheless we will respond in English.
- If you want support with installing the PostNL extension, please contact citservicedesk@postnl.nl for free support, or contact us directly at support@tig.nl for paid support plans.
- If you want support with installing the PostNL extension, please contact citservicedesk@postnl.nl for free support, or contact us directly at support@tig.nl for paid support plans.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ env:
# - MAGENTO_VERSION=2.2.4
# - MAGENTO_VERSION=2.2.5
- MAGENTO_VERSION=2.2.6
- MAGENTO_VERSION=2.2.7
# - MAGENTO_VERSION=2.2.7

matrix:
# PHP 7.1 would be supported in Magento since Magento 2.2
# 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.7
- php: 7.2
env: MAGENTO_VERSION=2.3.0
- php: 7.1
Expand Down
30 changes: 30 additions & 0 deletions Api/Data/ShipmentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,36 @@ public function getConfirmedAt();
* @return bool
*/
public function getConfirmed();

/**
* @return string|null
*/
public function setDownpartnerId($value);

/**
* @return string|null
*/
public function getDownpartnerId();

/**
* @return string|null
*/
public function setDownpartnerLocation($value);

/**
* @return string|null
*/
public function getDownpartnerLocation();

/**
* @return string|null
*/
public function setDownpartnerBarcode($value);

/**
* @return string|null
*/
public function getDownpartnerBarcode();

/**
* @param string $value
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Config/Support/SupportTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

class SupportTab extends Template implements RendererInterface
{
const POSTNL_VERSION = '1.7.3';
const POSTNL_VERSION = '1.7.4-RC1';

const XPATH_SUPPORTED_MAGENTO_VERSION = 'tig_postnl/supported_magento_version';

Expand Down
60 changes: 21 additions & 39 deletions Block/Adminhtml/Shipment/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,13 @@
// @codingStandardsIgnoreFile
class View extends MagentoView
{
/**
* @var string
*/
private $printRoute = 'postnl/shipment/confirmAndPrintShippingLabel';

/**
* @var string
*/
private $printLabel = 'PostNL - Confirm And Print Shipment Label';

/**
* @var PostNLShipmentRepository
*/
/** @var \TIG\PostNL\Model\ShipmentRepository $postNLShipmentRepository */
private $postNLShipmentRepository;

/**
* @var SearchCriteriaBuilder
*/
/** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder */
private $searchCriteriaBuilder;

/**
* @var ValidAddress
*/
/** @var \TIG\PostNL\Config\Validator\ValidAddress $validAddress */
private $validAddress;

/**
Expand All @@ -90,8 +74,7 @@ public function __construct(

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

// @codingStandardsIgnoreLine

protected function _construct()
{
parent::_construct();
Expand Down Expand Up @@ -120,7 +103,6 @@ protected function _construct()
private function processButtons()
{
$this->buttonList->remove('print');
//@codingStandardsIgnoreLine
$this->buttonList->update('save', 'label', __('Send Shipment Email'));
$this->setPostNLPrintLabelButton();
$this->setPostNLPrintLabelButtonData();
Expand All @@ -136,44 +118,43 @@ private function setPostNLPrintLabelButton()
$this->buttonList->add(
'postnl_print',
[
// @codingStandardsIgnoreLine
'label' => __($this->printLabel),
'label' => __('PostNL - Confirm And Print Shipment Label'),
'class' => 'save primary',
'onclick' => 'download(\'' .$this->getLabelUrl() .'\')'
]
);
}

/**
* Add the PostNL change confirmation button.
* Add the PostNL cancel confirmation button.
*/
private function setPostNLChangeConfirmButton()
private function setPostNLCancelConfirmButton()
{
/** @codingStandardsIgnoreStart */
$this->buttonList->add(
'postnl_change_confirm',
'postnl_cancel_confirm',
[
'label' => __('PostNL - Change Confirmation'),
'label' => __('PostNL - Cancel Confirmation'),
'class' => 'delete primary',
'onclick' =>
'deleteConfirm(\'' . __(
'Are you sure that you wish to reset the confirmation status of this shipment?'
. ' You will need to confirm this shipment with PostNL again before you can send it.'
.' This action will remove all barcodes'
. ' and labels associated with this shipment. You can not undo this action.'
) . '\', \'' . $this->getAlterUrl() . '\')'
) . '\', \'' . $this->getCancelConfirmationUrl() . '\')'
]
);
/** @codingStandardsIgnoreEnd */
}

private function setPostNLPrintLabelWithoutConfirmButton()
{
$postNLShipment = $this->getPostNLShipment();
$mainBarcode = $postNLShipment->getMainBarcode();

$this->buttonList->add(
'postnl_print_without_confirm',
[
// @codingStandardsIgnoreLine
'label' => __('PostNL - Print Label'),
'label' => $mainBarcode ? __('PostNL - Print Label') : __('PostNL - Generate Label'),
'class' => 'save primary',
'onclick' => 'download(\'' .$this->getLabelWithoutConfirmUrl() .'\')'
]
Expand All @@ -185,7 +166,6 @@ private function setPostNLPrintPackingslipButton()
$this->buttonList->add(
'postnl_print_packingslip',
[
// @codingStandardsIgnoreLine
'label' => __('PostNL - Print Packingslip'),
'class' => 'save primary',
'onclick' => 'download(\'' .$this->getPackingslipUrl() .'\')'
Expand All @@ -198,7 +178,6 @@ private function setPostNLConfirmButton()
$this->buttonList->add(
'postnl_confirm_shipment',
[
// @codingStandardsIgnoreLine
'label' => __('PostNL - Confirm'),
'class' => 'save primary',
'onclick' => 'setLocation(\'' . $this->getConfirmUrl() . '\')',
Expand All @@ -216,7 +195,7 @@ private function setPostNLPrintLabelButtonData()
$confirmedAt = $postNLShipment->getConfirmedAt();
if (!empty($confirmedAt)) {
$this->buttonList->remove('postnl_print');
$this->setPostNLChangeConfirmButton();
$this->setPostNLCancelConfirmButton();
}

if (empty($confirmedAt) && $postNLShipment->getMainBarcode()) {
Expand All @@ -229,7 +208,9 @@ private function setPostNLPrintLabelButtonData()
*/
private function getLabelUrl()
{
return $this->getUrl($this->printRoute, ['shipment_id' => $this->getShipment()->getId()]);
return $this->getUrl(
'postnl/shipment/confirmAndPrintShippingLabel',
['shipment_id' => $this->getShipment()->getId()]);
}

/**
Expand Down Expand Up @@ -268,19 +249,20 @@ private function getConfirmUrl()
/**
* @return string
*/
private function getAlterUrl()
private function getCancelConfirmationUrl()
{
/** @var PostNLShipment $postNLShipment */
$postNLShipment = $this->getPostNLShipment();

return $this->getUrl(
'postnl/shipment/ChangeConfirmation',
'postnl/shipment/CancelConfirmation',
[
'postnl_shipment_id' => $postNLShipment->getId(),
'shipment_id' => $this->getShipment()->getId(),
]
);
}

/**
* @return \TIG\PostNL\Api\Data\ShipmentInterface|null
*/
Expand Down
2 changes: 1 addition & 1 deletion Config/Source/Options/ProductOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function getEpsProductOptions($address = false)
if ($address && $address->getCountryId() === 'ES' && $this->canaryConverter->isCanaryIsland($address)) {
return $this->getGlobalPackOptions();
}
return $this->getProductoptions(['group' => 'eu_options']);
return $this->getProductoptions(['isEvening' => false, 'countryLimitation' => false, 'group' => 'eu_options']);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @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\Controller\Adminhtml\Shipment;

use Magento\Backend\App\Action;
Expand All @@ -37,59 +38,61 @@
use TIG\PostNL\Service\Shipment\ShipmentService;
use TIG\PostNL\Service\Shipment\ResetPostNLShipment;

class ChangeConfirmation extends Action
class CancelConfirmation extends Action
{
/**
* @var ShipmentService
*/
private $shipmentService;

/**
* @var ResetPostNLShipment
*/
private $resetService;

/**
* @var int
*/
private $postNLShipmentId;

/**
* @var int
*/
private $shipmentId;

/**
* @param Context $context
* @param ShipmentService $shipmentService
*/
public function __construct(
Context $context,
ShipmentService $shipmentService,
ResetPostNLShipment $resetService
) {
parent::__construct($context);

$this->shipmentService = $shipmentService;
$this->resetService = $resetService;
$this->shipmentService = $shipmentService;
$this->resetService = $resetService;
}

/**
* When you change the consignment confirmation,
* all the associated elements in question will be removed from the shipment.
* After that, new information like the shipping address can be set, before re-confirming the consignment.
*
* @return \Magento\Framework\Controller\Result\Redirect
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\Result\Redirect|\Magento\Framework\Controller\ResultInterface
* @throws \Magento\Framework\Exception\CouldNotDeleteException
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function execute()
{
$this->postNLShipmentId = $this->getRequest()->getParam('postnl_shipment_id');
$this->shipmentId = $this->getRequest()->getParam('shipment_id');

$this->resetService->resetShipment($this->shipmentId);

$resultDirect = $this->resultRedirectFactory->create();

return $resultDirect->setPath(
'sales/shipment/view',
['shipment_id' => $this->shipmentId]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
use Magento\Sales\Model\ResourceModel\Order\Shipment\CollectionFactory as ShipmentCollectionFactory;
use TIG\PostNL\Service\Shipment\ResetPostNLShipment;

class MassChangeConfirmation extends Action
class MassCancelConfirmation extends Action
{
/**
* @var Filter
Expand Down Expand Up @@ -77,11 +77,13 @@ public function __construct(
$this->collectionFactory = $collectionFactory;
$this->resetService = $resetService;
}

/**
* Dispatch request
*
* @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\Result\Redirect|\Magento\Framework\Controller\ResultInterface
* @throws \Magento\Framework\Exception\CouldNotDeleteException
* @throws \Magento\Framework\Exception\CouldNotSaveException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function execute()
Expand Down
2 changes: 1 addition & 1 deletion Helper/AddressEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected function parseResult($result, $address)
}

$address['housenumberExtension'] = '';
if ($result['addition']) {
if (isset($result['addition']) && $result['addition']) {
$address['housenumberExtension'] = trim($result['addition']);
}

Expand Down
4 changes: 2 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ public function getDayOrWeekNumber($date, $format = 'w')
/**
* @return bool|string
*/
public function getTommorowsDate()
public function getTomorrowsDate()
{
$dateTime = $this->dateTime->date($this->getCurrentDate());
return date('Y-m-d ' . $dateTime->format('H:i:s'), strtotime('tommorow'));
return date('Y-m-d ' . $dateTime->format('H:i:s'), strtotime('tomorrow'));
}

/**
Expand Down
Loading

0 comments on commit bc880dd

Please sign in to comment.