5use Bitrix\Location\Entity\Address;
6use Bitrix\Sale\Internals\Input;
8use Bitrix\Main\Localization\Loc;
9use Bitrix\Sale\Internals\OrderPropsGroupTable;
10use Bitrix\Sale\Internals\OrderPropsTable;
12Loc::loadMessages(__FILE__);
41 return $this->fields[
$name] ??
null;
54 '=ENTITY_REGISTRY_TYPE' => static::getRegistryType(),
55 '=ENTITY_TYPE' => static::getEntityType()
58 if (isset($parameters[
'filter']))
60 $filter[] = $parameters[
'filter'];
63 $parameters[
'filter'] =
$filter;
64 return OrderPropsTable::getList($parameters);
85 return new static(
$data);
100 static $groupList = [];
104 $dbRes = OrderPropsGroupTable::getList([
109 while ($group =
$dbRes->fetch())
121 'NAME' => Loc::getMessage(
'SOP_UNKNOWN_GROUP'),
139 if (isset($property[
'SETTINGS']) && is_array($property[
'SETTINGS']))
141 $property += $property[
'SETTINGS'];
142 unset ($property[
'SETTINGS']);
145 $this->fields = $property;
147 if ($relation ===
null)
152 $this->fields[
'RELATION'] = $relation;
154 if ($this->fields[
'TYPE'] ===
'ENUM')
156 if (!isset($property[
'OPTIONS']))
162 if (isset($this->fields[
'DEFAULT_VALUE']))
164 $this->fields[
'DEFAULT_VALUE'] = $this->
normalizeValue($this->fields[
'DEFAULT_VALUE']);
178 if ($this->fields[
'TYPE'] ===
'FILE')
182 elseif ($this->fields[
'TYPE'] ===
'ADDRESS' &&
Main\Loader::includeModule(
'location'))
184 if (is_array($value))
191 elseif (is_numeric($value))
196 $address = Address::load((
int)$value);
198 $value = ($address instanceof
Address) ? $address->toArray() :
null;
200 elseif (is_string($value) && !empty($value))
220 elseif ($this->fields[
'TYPE'] ===
"STRING")
222 if (isset($this->fields[
'IS_EMAIL']) && $this->fields[
'IS_EMAIL'] ===
"Y" && !empty($value))
224 $value = trim((
string)$value);
227 if (
Input\StringInput::isMultiple($value))
255 'select' => [
'VALUE',
'NAME'],
256 'filter' => [
'ORDER_PROPS_ID' => $this->
getId()],
257 'order' => [
'SORT' =>
'ASC']
288 $personTypeId = intval($personTypeId);
289 if ($personTypeId <= 0 || !is_array(
$request))
294 $dbRes = static::getList([
311 '=PERSON_TYPE_ID' => $personTypeId
315 while ($row =
$dbRes->fetch())
317 if (array_key_exists($row[
"ID"],
$request))
319 foreach ($row as
$key => $value)
321 if (($value ===
"Y") && (mb_substr(
$key, 0, 3) ===
"IS_"))
344 $this->
getField(
'TYPE') ===
"STRING"
345 && (
int)$this->
getField(
'MAXLENGTH') <= 0
348 $this->fields[
'MAXLENGTH'] = 500;
360 if (!is_array($item))
375 "SALE_PROPERTY_ERROR",
376 [
"#PROPERTY_NAME#" => $this->
getField(
'NAME'),
"#ERROR_MESSAGE#" => $message]
383 if (!is_array($value) && isset($value))
385 $value = trim((
string)$value);
387 if ($value !==
'' && $this->
getField(
'IS_EMAIL') ===
'Y')
393 Loc::getMessage(
"SALE_GOPE_WRONG_EMAIL")
418 foreach ($errorList as
$error)
448 if ($this->
getType() ==
'FILE')
452 foreach ($value as
$i => $file)
454 if (
Input\File::isDeletedSingle($file))
460 if (
Input\File::isUploadedSingle($file))
462 $fileId = \CFile::SaveFile(
array(
'MODULE_ID' =>
'sale') + $file,
'sale/order/properties');
463 if (is_numeric($fileId))
474 $propertyValue->setField(
'VALUE', $value);
477 $originalFields =
$propertyValue->getFields()->getOriginalValues();
480 Input\File::asMultiple(
Input\File::getValue($property, $originalFields[
'VALUE'])),
481 Input\File::asMultiple($value),
482 Input\File::asMultiple(
Input\File::getValue($property, $property[
'DEFAULT_VALUE']))
487 \CFile::Delete($fileId);
490 elseif ($this->
getType() ===
'ADDRESS' &&
Main\Loader::includeModule(
'location'))
492 if (!is_array($value))
497 $address = Address::fromArray($value);
527 $key = isset($this->property[
"ID"]) ? $this->
getId() :
"n".$values[
'ORDER_PROPS_ID'];
552 return $this->
getField(
'PERSON_TYPE_ID');
560 return $this->
getField(
'PROPS_GROUP_ID');
584 return $this->
getField(
'DESCRIPTION');
600 return $this->
getField(
'REQUIRED') ===
'Y';
608 return $this->
getField(
'UTIL') ===
'Y';
624 if ($this->
getType() ===
'FILE')
626 foreach (
Input\File::asMultiple($value) as $fileId)
628 \CFile::Delete($fileId);
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
static getList(array $parameters=array())
checkRequiredValue($value)
static getMeaningfulValues($personTypeId, $request)
__construct(array $property, array $relation=null)
getEditHtml(array $values)
getPreparedValueForSave(EntityPropertyValue $propertyValue)
getGroupInfo(bool $refreshData=false)
static getList(array $parameters=[])
static getObjectById($propertyId)
static getRelationsByPropertyId($propertyId)
const REGISTRY_TYPE_ORDER
</td ></tr ></table ></td ></tr ><?endif?><? $propertyIndex=0;foreach( $arGlobalProperties as $propertyCode=> $propertyValue
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
check_email($email, $strict=false, $domainCheck=false)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key