403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lpost.delivery/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lpost.delivery/lib/order.php
<?
namespace Lpost\Delivery;
use \Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);

class Order
{

    public static function getOrderAddress(\Bitrix\Sale\Order $order)
    {
        $addressCode = Settings::getInstance()->getOption("integration_field_address");

        $propertyCollection = $order->getPropertyCollection();

        if($address = $propertyCollection->getAddress())
        {
            return $address->getValue();
        }
        else
        {
            foreach ($propertyCollection as $property) {
                if ($property->getField('CODE') == $addressCode)
                {
                    return $property->getValue();
                }
            }
        }
        return false;
    }

    public static function getOrderLocation(\Bitrix\Sale\Order $order)
    {
        $locationCode = Settings::getInstance()->getOption("integration_field_location");

        $propertyCollection = $order->getPropertyCollection();
        if ($location = $propertyCollection->getDeliveryLocation())
        {
            return $location->getViewHtml();
        }
        else
        {
            foreach ($propertyCollection as $property) {
                if ($property->getField('CODE') == $locationCode)
                {
                    return $location->getViewHtml();
                }
            }
        }
        return false;
    }

    public static function setOrderAddress(&$order, $address)
    {
        $addressCode = Settings::getInstance()->getOption("integration_field_address");

        $propertyCollection = $order->getPropertyCollection();
        if($propertyCollection->getAddress())
        {
            $propertyCollection->getAddress()->setValue($address);
        }
        else
        {
            foreach ($propertyCollection as $property) {
                if ($property->getField('CODE') == $addressCode)
                {
                    $property->setValue($address);
                }
            }
        }
    }

    public static function getOrderName($order)
    {
        $nameCode = Settings::getInstance()->getOption("integration_field_fio");
        $propertyCollection = $order->getPropertyCollection();
        if($name = $propertyCollection->getPayerName())
        {
            return $name->getValue();
        }
        else
        {
            foreach ($propertyCollection as $property) {
                if ($property->getField('CODE') == $nameCode)
                {
                    return $property->getValue();
                }
            }
        }
        return false;
    }

    public static function getOrderPhone($order)
    {
        $phoneCode = Settings::getInstance()->getOption("integration_field_phone");
        $propertyCollection = $order->getPropertyCollection();
        if($phone = $propertyCollection->getPhone())
        {
            return $phone->getValue();
        }
        else
        {
            foreach ($propertyCollection as $property) {
                if ($property->getField('CODE') == $phoneCode)
                {
                    return $property->getValue();
                }
            }
        }
        return false;
    }

    public static function getOrderEmail($order)
    {
        $emailCode = Settings::getInstance()->getOption("integration_field_email");
        $propertyCollection = $order->getPropertyCollection();
        if($email = $propertyCollection->getUserEmail())
        {
            return $email->getValue();
        }
        else
        {
            foreach ($propertyCollection as $property) {
                if ($property->getField('CODE') == $emailCode)
                {
                    return $property->getValue();
                }
            }
        }
        return false;
    }

    public static function getOrderProp($order, $integrationName){
        $code = Settings::getInstance()->getOption($integrationName);
        $propertyCollection = $order->getPropertyCollection();

        foreach ($propertyCollection as $property) {
            if ($property->getField('CODE') == $code)
            {
                return $property->getValue();
            }
        }

        return "";
    }

    public static function getShipment(\Bitrix\Sale\Order $order){
        $shipmentCollection = $order->getShipmentCollection();
        foreach ($shipmentCollection as $shipment) {
            if (!$shipment->isSystem()) {
                return $shipment;
            }
        }
    }

    public static function getStatuses(): array
    {
        \Bitrix\Main\Loader::IncludeModule("sale");

        $arResult = [];

        $statusResult = \Bitrix\Sale\Internals\StatusLangTable::getList([
            'order' => ['STATUS.SORT' => 'ASC'],
            'filter' => ['STATUS.TYPE' => 'O', 'LID' => LANGUAGE_ID],
            'select' => ['STATUS_ID', 'NAME', 'DESCRIPTION'],
        ]);

        while ($arStatus = $statusResult->fetch()) {
            $arResult[$arStatus['STATUS_ID']] = $arStatus['NAME'];
        }

        return $arResult;
    }

    public static function writeAdditionalDataToField(\Bitrix\Sale\Order $order, $field_code, $data)
    {
        $propertyCollection = $order->getPropertyCollection();

        foreach ($propertyCollection as $property) {
            if ($property->getField('CODE') == $field_code) {
                $text = $property->getValue();
                $property->setField('VALUE', "\"#$data\" $text");
            }
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit