• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/recurring/entity/parametermapper/restinvoice.php
  • Класс: Bitrix\Crm\Recurring\Entity\ParameterMapper\RestInvoice
  • Вызов: RestInvoice::fillMap
public function fillMap(array $params = [])
{
	$scheme = $this->getScheme();
	foreach ($scheme as $code => $fieldName)
	{
		if ($fieldName === self::FIELD_PERIOD_NAME || $fieldName === self::FIELD_DATE_PAY_BEFORE_PERIOD_NAME)
		{
			$periodName = mb_strtolower($params[$fieldName]);
			$this->map[$code] = (int)Calculator::resolveTypeId($periodName);
		}
		elseif ($fieldName === self::FIELD_IS_WORKING_ONLY_NAME)
		{
			$item = $params[$fieldName];
			$this->map[$code] = !empty($this->weekDays[$item]) ? ($this->weekDays[$item] + 1) : (int)$item;
		}
		elseif ($fieldName === self::FIELD_IS_WORKING_ONLY_NAME)
		{
			$this->map[$code] = ($params[$fieldName] === 'Y') ? 'Y' : 'N';
		}
		else
		{
			$item = (int)$params[$fieldName];
			$this->map[$code] = ($item > 0) ? $item : 0;
		}
	}

	$this->mode = $this->map[self::FIELD_PERIOD];
	$this->unitType = $this->map[self::FIELD_TYPE];
	if ($this->mode === Calculator::SALE_TYPE_DAY_OFFSET)
	{
		$this->unitType = DateType\Day::TYPE_ALTERNATING_DAYS;
	}
	elseif ($this->mode === Calculator::SALE_TYPE_WEEK_OFFSET)
	{
		$this->unitType = DateType\Week::TYPE_ALTERNATING_WEEKDAYS;
	}

	$this->interval = $this->map[self::FIELD_INTERVAL];
	if ($this->mode === Calculator::SALE_TYPE_YEAR_OFFSET)
	{
		$this->interval = $this->map[self::FIELD_YEARLY_INTERVAL_MONTH];
	}

	$this->fillCompatibleFields();
}