|
5 | 5 | */
|
6 | 6 | namespace Magento\Sales\Model;
|
7 | 7 |
|
8 |
| -use Magento\Catalog\Api\ProductRepositoryInterface; |
9 | 8 | use Magento\Config\Model\Config\Source\Nooptreq;
|
10 | 9 | use Magento\Directory\Model\Currency;
|
11 | 10 | use Magento\Directory\Model\RegionFactory;
|
@@ -197,9 +196,10 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
|
197 | 196 | protected $_orderConfig;
|
198 | 197 |
|
199 | 198 | /**
|
200 |
| - * @var ProductRepositoryInterface |
| 199 | + * @var \Magento\Catalog\Api\ProductRepositoryInterface |
| 200 | + * @deprecated 100.1.0 Remove unused dependency. |
201 | 201 | */
|
202 |
| - protected ProductRepositoryInterface $productRepository; |
| 202 | + protected $productRepository; |
203 | 203 |
|
204 | 204 | /**
|
205 | 205 | * @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
|
@@ -339,7 +339,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface
|
339 | 339 | * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
|
340 | 340 | * @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
341 | 341 | * @param Order\Config $orderConfig
|
342 |
| - * @param ProductRepositoryInterface $productRepository |
| 342 | + * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository |
343 | 343 | * @param \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory $orderItemCollectionFactory
|
344 | 344 | * @param \Magento\Catalog\Model\Product\Visibility $productVisibility
|
345 | 345 | * @param \Magento\Sales\Api\InvoiceManagementInterface $invoiceManagement
|
@@ -378,7 +378,7 @@ public function __construct(
|
378 | 378 | \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
|
379 | 379 | \Magento\Store\Model\StoreManagerInterface $storeManager,
|
380 | 380 | \Magento\Sales\Model\Order\Config $orderConfig,
|
381 |
| - ProductRepositoryInterface $productRepository, |
| 381 | + \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, |
382 | 382 | \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory $orderItemCollectionFactory,
|
383 | 383 | \Magento\Catalog\Model\Product\Visibility $productVisibility,
|
384 | 384 | \Magento\Sales\Api\InvoiceManagementInterface $invoiceManagement,
|
@@ -750,11 +750,11 @@ private function canCreditmemoForZeroTotal($totalRefunded)
|
750 | 750 | $hasDueAmount = $this->canInvoice() && ($checkAmtTotalPaid);
|
751 | 751 | //case when paid amount is refunded and order has creditmemo created
|
752 | 752 | $creditmemos = ($this->getCreditmemosCollection() === false) ?
|
753 |
| - true : ($this->_memoCollectionFactory->create()->setOrderFilter($this)->getTotalCount() > 0); |
| 753 | + true : ($this->_memoCollectionFactory->create()->setOrderFilter($this)->getTotalCount() > 0); |
754 | 754 | $paidAmtIsRefunded = $this->getTotalRefunded() == $totalPaid && $creditmemos;
|
755 | 755 | if (($hasDueAmount || $paidAmtIsRefunded) ||
|
756 | 756 | (!$checkAmtTotalPaid &&
|
757 |
| - abs($totalRefunded - $this->getAdjustmentNegative()) < .0001)) { |
| 757 | + abs($totalRefunded - $this->getAdjustmentNegative()) < .0001)) { |
758 | 758 | return false;
|
759 | 759 | }
|
760 | 760 | return true;
|
@@ -839,49 +839,6 @@ public function canShip()
|
839 | 839 | return false;
|
840 | 840 | }
|
841 | 841 |
|
842 |
| - /** |
843 |
| - * Check if all items are remaining items after partially refunded are shipped |
844 |
| - * |
845 |
| - * @return bool |
846 |
| - */ |
847 |
| - public function isPartiallyRefundedOrderShipped(): bool |
848 |
| - { |
849 |
| - if ($this->getShippedItems() > 0 |
850 |
| - && $this->getTotalQtyOrdered() <= $this->getRefundedItems() + $this->getShippedItems()) { |
851 |
| - return true; |
852 |
| - } |
853 |
| - return false; |
854 |
| - } |
855 |
| - |
856 |
| - /** |
857 |
| - * Get all refunded items number |
858 |
| - * |
859 |
| - * @return int |
860 |
| - */ |
861 |
| - private function getRefundedItems(): int |
862 |
| - { |
863 |
| - $num_of_refunded_items = 0; |
864 |
| - foreach ($this->getAllItems() as $item) { |
865 |
| - if ($item->getProductType() == 'simple') { |
866 |
| - $num_of_refunded_items += (int)$item->getQtyRefunded(); |
867 |
| - } |
868 |
| - } |
869 |
| - return $num_of_refunded_items; |
870 |
| - } |
871 |
| - |
872 |
| - /** |
873 |
| - * Get all shipped items number |
874 |
| - * |
875 |
| - * @return int |
876 |
| - */ |
877 |
| - private function getShippedItems(): int |
878 |
| - { |
879 |
| - $num_of_shipped_items= 0; |
880 |
| - foreach ($this->getAllItems() as $item) { |
881 |
| - $num_of_shipped_items += (int)$item->getQtyShipped(); |
882 |
| - } |
883 |
| - return $num_of_shipped_items; |
884 |
| - } |
885 | 842 | /**
|
886 | 843 | * Check if item is refunded.
|
887 | 844 | *
|
|
0 commit comments