Skip to content

Commit

Permalink
Merge pull request #14 in DEV-MO/shopware5-module from fix/SHPWR-333_…
Browse files Browse the repository at this point in the history
…partial-send-cancel-return-broken to release/5.2.3

* commit '9c6b36e54cf999ed8a4df07f2de57b32f8aef922':
  fix/SHPWR-333_partial-send-cancel-return-broken fix sending
  • Loading branch information
rpWhittington committed Aug 23, 2018
2 parents 62f751a + 9c6b36e commit ff81b0c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
15 changes: 15 additions & 0 deletions Component/Mapper/BasketArrayBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ private function addShippingItemFromArray($item)
*/
private function addShippingItem($item)
{
//handle partial sending
if ($this->requestType === 'shipping' || $this->requestType === 'shippingRate') {
if ((int)($item->quantity) === 0) {
return;
}
}

//handle partial cancellation or return
if ($this->requestType === 'cancellation' || $this->requestType === 'return') {
$amountToCancelOrReturn = $this->getQuantityForRequest($item);
if ($amountToCancelOrReturn < 1) {
return;
}
}

if ($this->withRetry || $this->useFallbackShipping) {
$itemData = [
'ArticleNumber' => $item->articlenumber,
Expand Down
11 changes: 7 additions & 4 deletions Controller/backend/RpayRatepayOrderDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Shopware_Controllers_Backend_RpayRatepayOrderDetail extends Shopware_Contr
{

private $_config;

/** @var Shopware_Plugins_Frontend_RpayRatePay_Component_Mapper_ModelFactory */
private $_modelFactory;
private $_service;
private $_history;
Expand Down Expand Up @@ -242,14 +244,15 @@ public function cancelItemsAction()
// count all item which are in cancellation process
$itemsToCancel += $item->cancelledItems;

if ($item->quantity <= 0) {
/*
* Why a continue at the end of a loop
* if ($item->quantity <= 0) {
continue;
}
}*/
}

//only call the logic if there are items to cancel
if($itemsToCancel > 0)
{
if($itemsToCancel > 0) {
$operationData['orderId'] = $orderId;
$operationData['items'] = $items;
$operationData['subtype'] = 'cancellation';
Expand Down

0 comments on commit ff81b0c

Please sign in to comment.