23 private const USER_GROUP_ADMINS = 1;
24 private const USER_GROUP_ALL_USERS = 2;
35 $application->ResetException();
37 $fields[
'USER_GROUP'] = $fields[
'USER_GROUP_BUY'] = [self::USER_GROUP_ADMINS, self::USER_GROUP_ALL_USERS];
39 $addResult = \CCatalogGroup::Add($fields);
42 if ($application->GetException())
44 $this->
addError(
new Error($application->GetException()->GetString()));
53 return [
'PRICE_TYPE' => $this->
get($addResult)];
63 $existsResult = $this->
exists($id);
64 if (!$existsResult->isSuccess())
66 $this->addErrors($existsResult->getErrors());
71 $application->ResetException();
73 $updateResult = \CCatalogGroup::Update($id, $fields);
76 if ($application->GetException())
78 $this->
addError(
new Error($application->GetException()->GetString()));
87 return [
'PRICE_TYPE' => $this->
get($id)];
96 $existsResult = $this->
exists($id);
97 if (!$existsResult->isSuccess())
99 $this->addErrors($existsResult->getErrors());
104 $application->ResetException();
106 $deleteResult = \CCatalogGroup::Delete($id);
109 if ($application->GetException())
111 $this->
addError(
new Error($application->GetException()->GetString()));
142 $this->getList($select, $filter, $order, $pageNavigation),
143 $this->count($filter)
156 return [
'PRICE_TYPE' => $this->
get($id)];
160 $this->addErrors($r->getErrors());
171 return new \Bitrix\Catalog\GroupTable();
180 if (isset($this->
get($id)[
'ID']) ==
false)
182 $r->addError(
new Error(
'Price type is not exists'));
191 $entity = (
new self())->getEntity();
194 self::EVENT_ON_ADD => $entity->getModule().
'.price.type.on.add',
195 self::EVENT_ON_UPDATE => $entity->getModule().
'.price.type.on.update',
196 self::EVENT_ON_DELETE => $entity->getModule().
'.price.type.on.delete',
205 return [self::class,
'processItemEvent'];
215 $id = $arParams[0] ??
null;
218 throw new RestException(
'id not found trying to process event');
static getCallbackRestEvent()
updateAction(int $id, array $fields)
listAction(PageNavigation $pageNavigation, array $select=[], array $filter=[], array $order=[])
static processItemEvent(array $arParams, array $arHandler)