Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/extmag/shiplab/Block/Rma/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/extmag/shiplab/Block/Rma/Link.php
<?php
/**
 * Copyright © Extmag. All rights reserved.
 */

namespace Extmag\Shiplab\Block\Rma;

use Extmag\Shiplab\Model\ResourceModel\Label\CollectionFactory;
use Magento\Framework\App\DefaultPathInterface;
use Magento\Framework\Registry;
use Magento\Framework\View\Element\Html\Link\Current;
use Magento\Framework\View\Element\Template\Context;
use Magento\Sales\Model\Order;

/**
 * Sales order link
 *
 * @api
 * @SuppressWarnings(PHPMD.DepthOfInheritance)
 * @since 100.0.2
 */
class Link extends Current
{
    /**
     * @var Registry
     */
    protected $_registry;

    /**
     * @var CollectionFactory
     */
    protected $labelCollectionFactory;

    /**
     * @param Context $context
     * @param DefaultPathInterface $defaultPath
     * @param Registry $registry
     * @param CollectionFactory $labelCollectionFactory
     * @param array $data
     */
    public function __construct(
        Context              $context,
        DefaultPathInterface $defaultPath,
        Registry             $registry,
        CollectionFactory    $labelCollectionFactory,
        array                $data = []
    ) {
        parent::__construct($context, $defaultPath, $data);
        $this->_registry = $registry;
        $this->labelCollectionFactory = $labelCollectionFactory;
    }

    /**
     * Retrieve current order model instance
     *
     * @return Order
     */
    protected function getOrder()
    {
        return $this->_registry->registry('current_order');
    }

    /**
     * @inheritdoc
     *
     * @return string
     */
    public function getHref()
    {
        return $this->getUrl($this->getPath(), ['order_id' => $this->getOrder()->getId()]);
    }

    /**
     * @inheritdoc
     *
     * @return string
     */
    protected function _toHtml()
    {
        $labels = $this->labelCollectionFactory->create()
            ->addFieldToFilter('order_id', $this->getOrder()->getId())
            ->addFieldToFilter('status', 1)
            ->addFieldToFilter('type_direction', 'refund')
            ->addFieldToFilter('order_sub_type', ['neq' => 'refund']);
        if ($labels->count() == 0) {
            return '';
        }
        return parent::_toHtml();
    }
}

Spamworldpro Mini