Skip to content

Commit

Permalink
Don't download mailbox if label already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
reindertvetter committed Mar 9, 2017
1 parent 1543062 commit ca0926f
Showing 1 changed file with 62 additions and 47 deletions.
109 changes: 62 additions & 47 deletions Ui/Component/Listing/Column/TrackActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,54 +58,55 @@ public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as &$item) {
$item[$this->getData('name')]['action-download_package_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 1,
'mypa_request_type' => 'download'
]
),
'label' => __('Download package label'),
'hidden' => false,
];
$item[$this->getData('name')]['action-download_mailbox_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 2,
'mypa_request_type' => 'download'
]
),
'label' => __('Download mailbox label'),
'hidden' => false,
];
$item[$this->getData('name')]['action-download_letter_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 3,
'mypa_request_type' => 'download'
]
),
'label' => __('Download letter label'),
'hidden' => false,
];
$item[$this->getData('name')]['action-create_concept'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_request_type' => 'concept'
]
),
'label' => __('Create new concept'),
'hidden' => false,
];

if ($item['track_status'] == null) {
$item[$this->getData('name')]['action-download_package_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 1,
'mypa_request_type' => 'download'
]
),
'label' => __('Download package label'),
'hidden' => false,
];
$item[$this->getData('name')]['action-download_mailbox_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 2,
'mypa_request_type' => 'download'
]
),
'label' => __('Download mailbox label'),
'hidden' => false,
];
$item[$this->getData('name')]['action-download_letter_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 3,
'mypa_request_type' => 'download'
]
),
'label' => __('Download letter label'),
'hidden' => false,
];
$item[$this->getData('name')]['action-create_concept'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_request_type' => 'concept'
]
),
'label' => __('Create new concept'),
'hidden' => false,
];
$item[$this->getData('name')]['action-ship_direct'] = [
'href' => $this->urlBuilder->getUrl(
'adminhtml/order_shipment/start',
Expand All @@ -116,7 +117,21 @@ public function prepareDataSource(array $dataSource)
'label' => __('Ship'),
'hidden' => false,
];
} else {
$item[$this->getData('name')]['action-download_package_label'] = [
'href' => $this->urlBuilder->getUrl(
'myparcelnl/order/CreateAndPrintMyParcelTrack',
[
'selected_ids' => $item['entity_id'],
'mypa_package_type' => 1,
'mypa_request_type' => 'download'
]
),
'label' => __('Download label'),
'hidden' => false,
];
}

/**
* @todo; save link in table (set new zip)
*/
Expand Down

0 comments on commit ca0926f

Please sign in to comment.