1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
contractor.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog\Controller;
4
5use Bitrix\Main\Engine\CurrentUser;
6use Bitrix\Main\Error;
7use Bitrix\Catalog\Access\AccessController;
8use Bitrix\Catalog\Access\ActionDictionary;
9
11{
13 {
14 if (!AccessController::getCurrent()->check(ActionDictionary::ACTION_STORE_VIEW))
15 {
16 $this->addError(new Error('Access denied!'));
17
18 return null;
19 }
20
21 $companyName = $fields['companyName'];
22
23 if (empty($companyName))
24 {
25 $this->addError(new Error('Empty name'));
26
27 return null;
28 }
29
30 $userId = CurrentUser::get()->getId();
31 $fields = [
32 'PERSON_TYPE' => CONTRACTOR_JURIDICAL,
33 'COMPANY' => $companyName,
34 'CREATED_BY' => $userId,
35 'MODIFIED_BY' => $userId,
36 ];
37
38 $contractorId = \CCatalogContractor::add($fields);
39 if (!$contractorId)
40 {
41 $this->addError(new Error('Error adding contractor'));
42
43 return null;
44 }
45
46 return [
47 'id' => $contractorId
48 ];
49 }
50}
const CONTRACTOR_JURIDICAL
Определения include.php:55
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
createContractorAction(array $fields)
Определения contractor.php:12
addError(Error $error)
Определения controller.php:1070
Определения error.php:15
static add($arFields)
Определения contractor.php:14
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$companyName
Определения refund.php:15
$fields
Определения yandex_run.php:501