- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/update/userfield/crmquotefield.php
- Класс: Bitrix\Crm\Update\UserField\CrmQuoteField
- Вызов: CrmQuoteField::execute
public function execute(array &$result)
{
if(!Loader::includeModule("crm"))
return false;
$className = get_class($this);
$option = Option::get("crm", $className, 0);
$result["steps"] = $option;
$limit = 50;
$result["steps"] = isset($result["steps"]) ? $result["steps"] : 0;
$selectedRowsCount = 0;
$listUfFieldsForCheck = $this->getListUfFieldsForCheck("CRM_QUOTE");
$select = array("ID");
foreach($listUfFieldsForCheck as $fieldId => $field)
$select[] = $field["FIELD_NAME"];
$objectQuery = \CCrmQuote::getList(
array("ID" => "DESC"),
array("CHECK_PERMISSIONS" => "N"),
false,
false,
$select,
array("QUERY_OPTIONS" => array("LIMIT" => $limit, "OFFSET" => $result["steps"]))
);
if($objectQuery)
{
$selectedRowsCount = $objectQuery->selectedRowsCount();
while($entity = $objectQuery->fetch())
{
foreach($listUfFieldsForCheck as $fieldId => $field)
{
if(!empty($entity[$field["FIELD_NAME"]]))
{
$listValuesForUpdate = $this->prepareListValuesForUpdate($field, $entity);
$this->setFieldValue($field, $entity, $listValuesForUpdate);
}
}
}
}
if($selectedRowsCount < $limit)
{
Option::delete("crm", array("name" => $className));
return false;
}
else
{
$result["steps"] = $result["steps"] + $selectedRowsCount;
$option = $result["steps"];
Option::set("crm", $className, $option);
return true;
}
}