1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ecrmpropertyupdate.php
См. документацию.
1<?
3
9
11{
12 protected static $moduleId = "lists";
13
14 public function execute(array &$result)
15 {
16 if(!Loader::includeModule("lists"))
17 return false;
18
19 $className = get_class($this);
20 $option = Option::get("lists", $className, 0);
21 $result["steps"] = $option;
22
23 $limit = 20;
24 $result["steps"] = (int)($result["steps"] ?? 0);
25
26 $queryObject = PropertyTable::getList(array(
27 "select" => array("ID", "IBLOCK_ID", "USER_TYPE_SETTINGS"),
28 "filter" => array("=USER_TYPE" => "ECrm")
29 ));
30 $listIblockId = array();
31 $listPropertyId = array();
32 while($property = $queryObject->fetch())
33 {
34 if(is_string($property["USER_TYPE_SETTINGS"]) && CheckSerializedData($property["USER_TYPE_SETTINGS"]))
35 {
36 $property["USER_TYPE_SETTINGS"] = unserialize($property["USER_TYPE_SETTINGS"], ['allowed_classes' => false]);
37 }
38 if(is_array($property["USER_TYPE_SETTINGS"]))
39 {
40 if(array_key_exists("VISIBLE", $property["USER_TYPE_SETTINGS"]))
41 unset($property["USER_TYPE_SETTINGS"]["VISIBLE"]);
42 $tmpArray = array_filter($property["USER_TYPE_SETTINGS"], function($mark) { return $mark == "Y"; });
43 if(count($tmpArray) == 1)
44 {
45 $listIblockId[] = intval($property["IBLOCK_ID"]);
46 $listPropertyId[$property["IBLOCK_ID"]][] = intval($property["ID"]);
47 }
48 }
49 }
50
51 $connection = Application::getInstance()->getConnection();
52 $listIblockIdS = implode(",", $listIblockId);
53 if(empty($listIblockIdS))
54 {
55 return false;
56 }
57
58 $sqlString = "SELECT ID, IBLOCK_ID FROM b_iblock_element WHERE IBLOCK_ID IN (".$listIblockIdS
59 .") ORDER BY ID ASC LIMIT ".$limit." OFFSET ".$result["steps"];
60 $queryObject = $connection->query($sqlString);
61 $listElement = $queryObject->fetchAll();
62 $selectedRowsCount = $queryObject->getSelectedRowsCount();
63 $listElementData = array();
64 foreach($listElement as $element)
65 {
66 $listElementData[$element["IBLOCK_ID"]][] = $element["ID"];
67 }
68
69 foreach($listElementData as $iblockId => $listElementId)
70 {
71 $queryObject = \CIblockElement::getPropertyValues(
72 $iblockId, array("ID" => $listElementId), false, array("ID" => $listPropertyId[$iblockId]));
73 while($propertyValues = $queryObject->fetch())
74 {
75
76 foreach($propertyValues as $propertyId => $propertyValue)
77 {
78 if($propertyId == "IBLOCK_ELEMENT_ID" || empty($propertyValue))
79 continue;
80
81 $isDamaged = false;
82 if(is_array($propertyValue))
83 {
84 $listPropertyValues = array();
85 foreach ($propertyValue as $value)
86 {
87 if(!intval($value))
88 {
89 $explode = explode('_', $value);
90 $listPropertyValues[] = intval($explode[1]);
91 $isDamaged = true;
92 }
93 }
94 $propertyValue = $listPropertyValues;
95 }
96 else
97 {
98 if(!intval($propertyValue))
99 {
100 $explode = explode('_', $propertyValue);
101 $propertyValue = intval($explode[1]);
102 $isDamaged = true;
103 }
104 }
105 if($isDamaged && $propertyId)
106 {
107 \CIBlockElement::setPropertyValues(
108 $propertyValues["IBLOCK_ELEMENT_ID"], $iblockId, $propertyValue, $propertyId);
109 }
110 }
111 }
112 }
113
114 if($selectedRowsCount < $limit)
115 {
116 Option::delete("lists", array("name" => $className));
117 return false;
118 }
119 else
120 {
121 $result["steps"] = $result["steps"] + $selectedRowsCount;
122 $option = $result["steps"];
123 Option::set("lists", $className, $option);
124 return true;
125 }
126 }
127}
$connection
Определения actionsdefinitions.php:38
Определения loader.php:13
</td ></tr ></table ></td ></tr ><?endif?><? $propertyIndex=0;foreach( $arGlobalProperties as $propertyCode=> $propertyValue
Определения file_new.php:729
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$iblockId
Определения iblock_catalog_edit.php:30
CheckSerializedData($str, $max_depth=200)
Определения tools.php:4949
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$option
Определения options.php:1711