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/fooman/pdfcore-m2/src/Block/Pdf/Column/Renderer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/fooman/pdfcore-m2/src/Block/Pdf/Column/Renderer/Qty.php
<?php
/**
 * @copyright Copyright (c) 2015 Fooman Limited (http://www.fooman.co.nz)
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Fooman\PdfCore\Block\Pdf\Column\Renderer;

class Qty extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
{
    public const XML_PATH_QTY_AS_INT = 'sales_pdf/all/allqtyasint';
    public const XML_PATH_QTY_HIGHLIGHT_STYLE = 'sales_pdf/all/qty_highlight_style';

    public const QTY_STYLE_NONE = 0;
    public const QTY_STYLE_BOLD = 1;
    public const QTY_STYLE_RED = 2;
    public const QTY_STYLE_RED_BOLD = 3;

    /**
     * Renders grid column
     *
     * @param \Magento\Framework\DataObject $row
     *
     * @return mixed
     */
    // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Magento 2 Core use
    public function _getValue(\Magento\Framework\DataObject $row)
    {
        $qty = parent::_getValue($row);
        if ($qty) {
            $qty = sprintf("%01.4f", parent::_getValue($row));
        }
        if ($qty && $this->_scopeConfig->getValue(
            self::XML_PATH_QTY_AS_INT,
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $row->getStoreId()
        )
        ) {
            $qty = (int)$qty;
        }
        $qtyStyle = $this->_scopeConfig->getValue(
            self::XML_PATH_QTY_HIGHLIGHT_STYLE,
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
            $row->getStoreId()
        );
        if ($qty > 1 && $qtyStyle == self::QTY_STYLE_BOLD) {
            $qty = '<b>' . $qty . '</b>';
        }
        if ($qty > 1 && $qtyStyle == self::QTY_STYLE_RED) {
            $qty = '<span style="color:red">' . $qty . '</span>';
        }
        if ($qty > 1 && $qtyStyle == self::QTY_STYLE_RED_BOLD) {
            $qty = '<span style="color:red; font-weight: bold">' . $qty . '</span>';
        }
        return $this->escapeHtml($qty, ['b','span']);
    }
}

Spamworldpro Mini